Spaces:
Running
Running
Changed loading scripts in app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
# app.py - Main entry point for Hugging Face Spaces
|
| 2 |
-
import sys
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
|
| 11 |
if __name__ == "__main__":
|
| 12 |
import uvicorn
|
|
|
|
| 1 |
# app.py - Main entry point for Hugging Face Spaces
|
|
|
|
| 2 |
import os
|
| 3 |
+
import importlib.util
|
| 4 |
|
| 5 |
+
# Load the FastAPI app from code/app.py via importlib to avoid
|
| 6 |
+
# conflicts with the standard-library module named `code`.
|
| 7 |
+
HERE = os.path.dirname(__file__)
|
| 8 |
+
app_path = os.path.join(HERE, "code", "app.py")
|
| 9 |
+
spec = importlib.util.spec_from_file_location("antique_auth_code_app", app_path)
|
| 10 |
+
module = importlib.util.module_from_spec(spec)
|
| 11 |
+
spec.loader.exec_module(module)
|
| 12 |
|
| 13 |
+
# The FastAPI `app` object expected inside code/app.py
|
| 14 |
+
app = getattr(module, "app")
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
import uvicorn
|