Spaces:
Running
Running
Reverted changes
Browse files- app.py +8 -0
- code/app.py +5 -0
app.py
CHANGED
|
@@ -18,6 +18,14 @@ spec = importlib.util.spec_from_file_location("antique_auth_code_app", app_path)
|
|
| 18 |
module = importlib.util.module_from_spec(spec)
|
| 19 |
spec.loader.exec_module(module)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# The FastAPI `app` object expected inside code/app.py
|
| 22 |
app = getattr(module, "app")
|
| 23 |
|
|
|
|
| 18 |
module = importlib.util.module_from_spec(spec)
|
| 19 |
spec.loader.exec_module(module)
|
| 20 |
|
| 21 |
+
# Optionally: remove CODE_DIR from sys.path after loading to avoid side effects
|
| 22 |
+
try:
|
| 23 |
+
# remove the first occurrence we added
|
| 24 |
+
if sys.path[0] == CODE_DIR:
|
| 25 |
+
sys.path.pop(0)
|
| 26 |
+
except Exception:
|
| 27 |
+
pass
|
| 28 |
+
|
| 29 |
# The FastAPI `app` object expected inside code/app.py
|
| 30 |
app = getattr(module, "app")
|
| 31 |
|
code/app.py
CHANGED
|
@@ -209,3 +209,8 @@ def root():
|
|
| 209 |
"endpoints": {"POST /predict": "Evaluate auction", "GET /health": "Health check"},
|
| 210 |
}
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
"endpoints": {"POST /predict": "Evaluate auction", "GET /health": "Health check"},
|
| 210 |
}
|
| 211 |
|
| 212 |
+
|
| 213 |
+
if __name__ == "__main__":
|
| 214 |
+
import uvicorn
|
| 215 |
+
|
| 216 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|