@@ -346,18 +346,28 @@ def signal_handler(signal, frame, postgres_process):
346
346
stop_postgres (postgres_process )
347
347
sys .exit (0 )
348
348
349
- print ("Starting React UI..." )
350
- subprocess .Popen (
351
- "npm start --prefix react-ui" ,
352
- env = {
353
- ** os .environ ,
354
- "GRADIO_BACKEND_AUTOMATIC" : f"http://127.0.0.1:{ gradio_interface_options ['server_port' ]} " ,
355
- },
356
- shell = True ,
357
- )
358
- if "--docker" in os .sys .argv :
359
- print ("Info: Docker mode: skipping Postgres" )
349
+ # Check for --no-react flag
350
+ if "--no-react" not in os .sys .argv :
351
+ print ("Starting React UI..." )
352
+ subprocess .Popen (
353
+ "npm start --prefix react-ui" ,
354
+ env = {
355
+ ** os .environ ,
356
+ "GRADIO_BACKEND_AUTOMATIC" : f"http://127.0.0.1:{ gradio_interface_options ['server_port' ]} " ,
357
+ },
358
+ shell = True ,
359
+ )
360
+ else :
361
+ print ("Skipping React UI (--no-react flag detected)" )
362
+
363
+ # Check for --no-database or docker flag
364
+ if "--no-database" in os .sys .argv or "--docker" in os .sys .argv :
365
+ if "--docker" in os .sys .argv :
366
+ print ("Info: Docker mode: skipping Postgres" )
367
+ else :
368
+ print ("Skipping Postgres (--no-database flag detected)" )
360
369
return
370
+
361
371
print ("Starting Postgres..." )
362
372
postgres_process = subprocess .Popen (f"postgres -D { postgres_dir } -p 7773" , shell = True )
363
373
try :
@@ -386,7 +396,7 @@ def signal_handler(signal, frame, postgres_process):
386
396
server_hypervisor ()
387
397
import webbrowser
388
398
389
- if gradio_interface_options ["inbrowser" ]:
399
+ if gradio_interface_options ["inbrowser" ] and "--no-react" not in os . sys . argv :
390
400
webbrowser .open ("http://localhost:3000" )
391
401
392
402
start_gradio_server ()
0 commit comments