CodeChamp95 commited on
Commit
83ef274
Β·
verified Β·
1 Parent(s): 8d81cc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -600,18 +600,20 @@ def build_app():
600
  # Entry point
601
  # ──────────────────────────────────────────────────────────────────────────────
602
 
603
- if __name__ == "__main__":
604
- app = build_app()
605
- app.launch(
606
- server_name="0.0.0.0",
607
- server_port=7860,
608
- share=False,
609
- show_error=True,
610
- ssr_mode=False,
611
- theme=gr.themes.Base(
612
- primary_hue="blue",
613
- neutral_hue="slate",
614
- font=[gr.themes.GoogleFont("Lato"), "sans-serif"],
615
- ),
616
- css=CUSTOM_CSS,
617
- )
 
 
 
600
  # Entry point
601
  # ──────────────────────────────────────────────────────────────────────────────
602
 
603
+ # Build the app at module level so HuggingFace Spaces can import it correctly.
604
+ # The `if __name__ == "__main__"` guard prevented launch() from running on Spaces
605
+ # because HF imports app.py rather than executing it as a script.
606
+ app = build_app()
607
+ app.launch(
608
+ server_name="0.0.0.0",
609
+ server_port=7860,
610
+ share=False,
611
+ show_error=True,
612
+ ssr_mode=False,
613
+ theme=gr.themes.Base(
614
+ primary_hue="blue",
615
+ neutral_hue="slate",
616
+ font=[gr.themes.GoogleFont("Lato"), "sans-serif"],
617
+ ),
618
+ css=CUSTOM_CSS,
619
+ )