AdnanElAssadi commited on
Commit
8788d4a
·
verified ·
1 Parent(s): eb23625

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -858,15 +858,18 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
858
 
859
  if __name__ == "__main__":
860
  try:
861
- # Disable autoreloading to prevent restart loops
862
- demo.launch(prevent_thread_lock=True, autoreload=False)
 
 
 
863
  except Exception as e:
864
  import traceback
865
  print(f"Error launching demo: {traceback.format_exc()}")
866
  print("\nTrying alternative launch method...")
867
  try:
868
- # Alternative launch method also with autoreload disabled
869
- demo.launch(share=False, debug=True, autoreload=False)
870
  except Exception as e2:
871
  print(f"Alternative launch also failed: {str(e2)}")
872
  print("\nPlease check your Gradio installation and try again.")
 
858
 
859
  if __name__ == "__main__":
860
  try:
861
+ # Use options compatible with Gradio 3.42.0
862
+ import os
863
+ # Disable file watching to prevent restart loops
864
+ os.environ['GRADIO_WATCH'] = 'no'
865
+ demo.launch(prevent_thread_lock=True)
866
  except Exception as e:
867
  import traceback
868
  print(f"Error launching demo: {traceback.format_exc()}")
869
  print("\nTrying alternative launch method...")
870
  try:
871
+ # Alternative launch method
872
+ demo.launch(share=False, debug=True)
873
  except Exception as e2:
874
  print(f"Alternative launch also failed: {str(e2)}")
875
  print("\nPlease check your Gradio installation and try again.")