Spaces:
Sleeping
Sleeping
fix port
Browse files- app.py +9 -1
- requirements.txt +2 -1
app.py
CHANGED
@@ -8,6 +8,7 @@ import asyncio
|
|
8 |
import time
|
9 |
import logging
|
10 |
from contextlib import asynccontextmanager
|
|
|
11 |
|
12 |
# Configure logging
|
13 |
logging.basicConfig(
|
@@ -135,4 +136,11 @@ async def clear_user_memory(user_id: str):
|
|
135 |
raise HTTPException(status_code=500, detail=str(e))
|
136 |
|
137 |
if __name__ == "__main__":
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
import time
|
9 |
import logging
|
10 |
from contextlib import asynccontextmanager
|
11 |
+
import os
|
12 |
|
13 |
# Configure logging
|
14 |
logging.basicConfig(
|
|
|
136 |
raise HTTPException(status_code=500, detail=str(e))
|
137 |
|
138 |
if __name__ == "__main__":
|
139 |
+
# Khi chạy local
|
140 |
+
if os.getenv("DEVELOPMENT"):
|
141 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
142 |
+
else:
|
143 |
+
# Khi deploy trên Hugging Face
|
144 |
+
import nest_asyncio
|
145 |
+
nest_asyncio.apply()
|
146 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
requirements.txt
CHANGED
@@ -9,4 +9,5 @@ langchain-pinecone==0.2.3
|
|
9 |
fastapi==0.115.3
|
10 |
uvicorn==0.31.0
|
11 |
sentence-transformers==2.5.1
|
12 |
-
requests==2.31.0
|
|
|
|
9 |
fastapi==0.115.3
|
10 |
uvicorn==0.31.0
|
11 |
sentence-transformers==2.5.1
|
12 |
+
requests==2.31.0
|
13 |
+
nest-asyncio==1.5.8
|