Spaces:
Sleeping
Sleeping
joelazo
Claude
commited on
Commit
·
488b15f
1
Parent(s):
fbd8e40
Fix HuggingFace Spaces deployment
Browse files- Move demo creation to module level
- HuggingFace Spaces requires demo object at module level
- Theme and demo now initialized outside functions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
- translator.py +11 -10
translator.py
CHANGED
|
@@ -385,18 +385,19 @@ def create_ui():
|
|
| 385 |
# Main Entry Point
|
| 386 |
# ============================================================================
|
| 387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
def main():
|
| 389 |
"""Main entry point for the translator app."""
|
| 390 |
-
# Create custom theme
|
| 391 |
-
theme = gr.themes.Soft(
|
| 392 |
-
primary_hue=UIConfig.THEME_PRIMARY_HUE,
|
| 393 |
-
secondary_hue=UIConfig.THEME_SECONDARY_HUE,
|
| 394 |
-
neutral_hue=UIConfig.THEME_NEUTRAL_HUE,
|
| 395 |
-
font=UIConfig.THEME_FONT
|
| 396 |
-
)
|
| 397 |
-
|
| 398 |
-
# Create and launch the UI
|
| 399 |
-
demo = create_ui()
|
| 400 |
demo.launch(
|
| 401 |
share=UIConfig.SHARE_LINK,
|
| 402 |
inbrowser=UIConfig.OPEN_IN_BROWSER,
|
|
|
|
| 385 |
# Main Entry Point
|
| 386 |
# ============================================================================
|
| 387 |
|
| 388 |
+
# Create custom theme
|
| 389 |
+
theme = gr.themes.Soft(
|
| 390 |
+
primary_hue=UIConfig.THEME_PRIMARY_HUE,
|
| 391 |
+
secondary_hue=UIConfig.THEME_SECONDARY_HUE,
|
| 392 |
+
neutral_hue=UIConfig.THEME_NEUTRAL_HUE,
|
| 393 |
+
font=UIConfig.THEME_FONT
|
| 394 |
+
)
|
| 395 |
+
|
| 396 |
+
# Create the demo at module level (required for HuggingFace Spaces)
|
| 397 |
+
demo = create_ui()
|
| 398 |
+
|
| 399 |
def main():
|
| 400 |
"""Main entry point for the translator app."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
demo.launch(
|
| 402 |
share=UIConfig.SHARE_LINK,
|
| 403 |
inbrowser=UIConfig.OPEN_IN_BROWSER,
|