Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,35 +76,3 @@ if text:
|
|
| 76 |
"confidence": "{:.2f}".format(float(confidence_score[0] * 100)) + "%"} # Adjust as necessary for output formatting
|
| 77 |
st.json(response)
|
| 78 |
|
| 79 |
-
# Add a POST endpoint
|
| 80 |
-
def api_predict(text):
|
| 81 |
-
prediction, confidence_score = getPrediction(text)
|
| 82 |
-
return {
|
| 83 |
-
"prediction": getSentiment(prediction) + " Statement",
|
| 84 |
-
"confidence": f"{confidence_score * 100:.2f}%"
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
st.experimental_set_query_params(api_predict=api_predict)
|
| 88 |
-
|
| 89 |
-
# # Streamlit UI
|
| 90 |
-
# st.title("Sentiment Analysis")
|
| 91 |
-
|
| 92 |
-
# # Use st.query_params to get the 'text' parameter from the URL
|
| 93 |
-
# query_text = st.query_params.get("text", [""])[0] # Accessing 'text' from query params
|
| 94 |
-
|
| 95 |
-
# if query_text:
|
| 96 |
-
# # If text is passed in the URL, process it
|
| 97 |
-
# prediction, confidence_score = getPrediction(query_text)
|
| 98 |
-
# st.json({
|
| 99 |
-
# "prediction": getSentiment(prediction) + " Statement",
|
| 100 |
-
# "confidence": f"{confidence_score * 100:.2f}%"
|
| 101 |
-
# })
|
| 102 |
-
# else:
|
| 103 |
-
# # Normal Streamlit app interface for manual text entry
|
| 104 |
-
# input_text = st.text_area("Enter Text for Sentiment Analysis")
|
| 105 |
-
# if input_text:
|
| 106 |
-
# prediction, confidence_score = getPrediction(input_text)
|
| 107 |
-
# st.json({
|
| 108 |
-
# "prediction": getSentiment(prediction) + " Statement",
|
| 109 |
-
# "confidence": f"{confidence_score * 100:.2f}%"
|
| 110 |
-
# })
|
|
|
|
| 76 |
"confidence": "{:.2f}".format(float(confidence_score[0] * 100)) + "%"} # Adjust as necessary for output formatting
|
| 77 |
st.json(response)
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|