Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
from fastapi import FastAPI
|
2 |
-
from pydantic import BaseModel
|
3 |
-
from transformers import pipeline
|
4 |
-
|
5 |
-
# Load emotion model
|
6 |
-
classifier = pipeline("text-classification", model="SamLowe/roberta-base-go_emotions", top_k=None)
|
7 |
-
|
8 |
-
app = FastAPI(title="Emotion Detection API")
|
9 |
-
|
10 |
-
class TextInput(BaseModel):
|
11 |
-
text: str
|
12 |
-
|
13 |
-
@app.post("/analyze")
|
14 |
-
def analyze_emotion(data: TextInput):
|
15 |
-
result = classifier(data.text)
|
16 |
-
return {"emotions": result}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|