Spaces:
Sleeping
Sleeping
JSON Format Fixes
Browse files
main.py
CHANGED
@@ -37,11 +37,11 @@ def predict(input):
|
|
37 |
rets = logits.argmax(dim = 1).tolist()
|
38 |
|
39 |
labels = ["positive", "neutral", "negative"]
|
40 |
-
return
|
41 |
|
42 |
@app.post("/predict")
|
43 |
def get_sentiment(data: TextInput):
|
44 |
-
return predict(data.text)
|
45 |
|
46 |
if __name__ == "__main__":
|
47 |
import uvicorn
|
|
|
37 |
rets = logits.argmax(dim = 1).tolist()
|
38 |
|
39 |
labels = ["positive", "neutral", "negative"]
|
40 |
+
return [labels[ret] for ret in rets]
|
41 |
|
42 |
@app.post("/predict")
|
43 |
def get_sentiment(data: TextInput):
|
44 |
+
return {predict(data.text)}
|
45 |
|
46 |
if __name__ == "__main__":
|
47 |
import uvicorn
|