Spaces:
Running
Running
lucabadiali
commited on
Commit
·
295d729
1
Parent(s):
f7003b3
AA
Browse files- Dockerfile +1 -1
- src/app/app.py +3 -0
Dockerfile
CHANGED
|
@@ -18,4 +18,4 @@ COPY --chown=user . .
|
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# 7. Start the app
|
| 21 |
-
CMD [ "python3","-m", "uvicorn", "src.app.app:app", "--
|
|
|
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# 7. Start the app
|
| 21 |
+
CMD [ "python3","-m", "uvicorn", "src.app.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
src/app/app.py
CHANGED
|
@@ -26,6 +26,9 @@ labels = [row[1] for row in csvreader if len(row) > 1]
|
|
| 26 |
|
| 27 |
tokenizer, model = load_model_and_tokenizer(MODEL_SOURCE)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
@app.post("/predict")
|
| 31 |
async def analyze_text(query:SentimentQuery):
|
|
|
|
| 26 |
|
| 27 |
tokenizer, model = load_model_and_tokenizer(MODEL_SOURCE)
|
| 28 |
|
| 29 |
+
@app.get("/")
|
| 30 |
+
def read_root():
|
| 31 |
+
return {"status": "ok", "message": "Sentiment API is running"}
|
| 32 |
|
| 33 |
@app.post("/predict")
|
| 34 |
async def analyze_text(query:SentimentQuery):
|