Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,20 +38,12 @@ def textclassification():
|
|
| 38 |
st.write(f"Sentiment: {sentiment}")
|
| 39 |
st.write(f"Confidence: {confidence:.2f}")
|
| 40 |
|
| 41 |
-
# Determine the rating based on sentiment
|
| 42 |
-
if sentiment == "POSITIVE":
|
| 43 |
-
rating = 5 # Assign a rating of 5 stars for positive sentiment
|
| 44 |
-
elif sentiment == "NEUTRAL":
|
| 45 |
-
rating = 3 # Assign a neutral rating of 3 stars
|
| 46 |
-
else: # Assuming the other sentiment is "NEGATIVE"
|
| 47 |
-
rating = 1 # Assign a rating of 1 star for negative sentiment
|
| 48 |
-
|
| 49 |
# Display the rating
|
| 50 |
-
st.write(f"The rating is {
|
| 51 |
|
| 52 |
# Question Answering
|
| 53 |
qa_input = {
|
| 54 |
-
'question': f'Why is the rating {
|
| 55 |
'context': user_input # Use user input as context
|
| 56 |
}
|
| 57 |
qa_result = qa_pipeline(qa_input)
|
|
|
|
| 38 |
st.write(f"Sentiment: {sentiment}")
|
| 39 |
st.write(f"Confidence: {confidence:.2f}")
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# Display the rating
|
| 42 |
+
st.write(f"The rating is {sentiment} stars")
|
| 43 |
|
| 44 |
# Question Answering
|
| 45 |
qa_input = {
|
| 46 |
+
'question': f'Why is the rating {sentiment} star?',
|
| 47 |
'context': user_input # Use user input as context
|
| 48 |
}
|
| 49 |
qa_result = qa_pipeline(qa_input)
|