Tonic commited on
Commit
8493b64
Β·
unverified Β·
1 Parent(s): d1c1083

add demo launch

Browse files
Files changed (1) hide show
  1. main.py +7 -10
main.py CHANGED
@@ -587,13 +587,10 @@ with gr.Blocks() as demo:
587
  outputs=[audio_output_0, audio_output_1]
588
  )
589
 
590
- # Add cleanup on close
591
- demo.load(lambda: None, [], [], _js="() => { window.addEventListener('beforeunload', () => { cleanup_cache(); }); }")
592
- # Launch with cleanup and error handling
593
- try:
594
- demo.queue().launch(ssr_mode=False
595
- )
596
- except Exception as e:
597
- print(f"Error launching demo: {str(e)}")
598
- finally:
599
- cleanup_cache()
 
587
  outputs=[audio_output_0, audio_output_1]
588
  )
589
 
590
+ if __name__ == "__main__":
591
+ try:
592
+ demo.queue().launch(ssr_mode=False)
593
+ except Exception as e:
594
+ print(f"Error launching demo: {str(e)}")
595
+ finally:
596
+ cleanup_cache()