Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,27 +1,31 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Hugging Face Spaces entry point for Context Thread Agent
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
import os
|
| 7 |
import sys
|
| 8 |
from pathlib import Path
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
sys.path.insert(0, str(current_dir / "src"))
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
+
"""Hugging Face Spaces entry point"""
|
|
|
|
|
|
|
|
|
|
| 3 |
import os
|
| 4 |
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
+
# Get the app directory
|
| 8 |
+
app_dir = Path(__file__).parent
|
| 9 |
+
os.chdir(app_dir)
|
|
|
|
| 10 |
|
| 11 |
+
# Add to path
|
| 12 |
+
if str(app_dir) not in sys.path:
|
| 13 |
+
sys.path.insert(0, str(app_dir))
|
| 14 |
|
| 15 |
+
# Now try the import
|
| 16 |
+
try:
|
| 17 |
+
from ui.app import create_gradio_app
|
| 18 |
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
demo = create_gradio_app()
|
| 21 |
+
demo.launch(
|
| 22 |
+
server_name="0.0.0.0",
|
| 23 |
+
server_port=int(os.environ.get("PORT", 7860)),
|
| 24 |
+
show_error=True
|
| 25 |
+
)
|
| 26 |
+
except ImportError as e:
|
| 27 |
+
print(f"Import error: {e}")
|
| 28 |
+
print(f"Current directory: {os.getcwd()}")
|
| 29 |
+
print(f"Python path: {sys.path}")
|
| 30 |
+
print(f"Files in current dir: {list(app_dir.iterdir())}")
|
| 31 |
+
raise
|