Spaces:
Runtime error
Runtime error
Commit
·
f1c9ff7
1
Parent(s):
9dbd96b
Update app.py
Browse files
app.py
CHANGED
@@ -146,6 +146,10 @@ tokenizer = transformers.AutoTokenizer.from_pretrained("DeeeTeeee01/mytest_train
|
|
146 |
|
147 |
@st.cache_resource
|
148 |
def predict_sentiment(text):
|
|
|
|
|
|
|
|
|
149 |
|
150 |
# Get full model outputs
|
151 |
outputs = model(text)
|
@@ -171,14 +175,8 @@ text = st.text_input("Enter text:")
|
|
171 |
predict_button = st.button("Predict")
|
172 |
|
173 |
# Prediction output
|
174 |
-
|
175 |
-
|
176 |
-
inputs = tokenizer(text, return_tensors="pt")
|
177 |
-
|
178 |
-
outputs = model(**inputs)
|
179 |
|
180 |
-
# Rest of code to extract probabilities
|
181 |
-
|
182 |
# Get probabilities
|
183 |
negative, positive, neutral = predict_sentiment(text)
|
184 |
|
|
|
146 |
|
147 |
@st.cache_resource
|
148 |
def predict_sentiment(text):
|
149 |
+
|
150 |
+
inputs = tokenizer(text, return_tensors="pt")
|
151 |
+
|
152 |
+
outputs = model(**inputs)
|
153 |
|
154 |
# Get full model outputs
|
155 |
outputs = model(text)
|
|
|
175 |
predict_button = st.button("Predict")
|
176 |
|
177 |
# Prediction output
|
178 |
+
if predict_button and text:
|
|
|
|
|
|
|
|
|
179 |
|
|
|
|
|
180 |
# Get probabilities
|
181 |
negative, positive, neutral = predict_sentiment(text)
|
182 |
|