Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,15 +40,9 @@ def create_table(predictions):
|
|
| 40 |
st.title('Toxicity Prediction App')
|
| 41 |
tweet=st.text_input('Enter a tweet to check for toxicity')
|
| 42 |
|
| 43 |
-
async def run_async_function(tweet, model, tokenizer):
|
| 44 |
-
loop = asyncio.new_event_loop()
|
| 45 |
-
asyncio.set_event_loop(loop)
|
| 46 |
-
result = await loop.run_in_executor(None, prediction, tweet, model, tokenizer)
|
| 47 |
-
loop.close()
|
| 48 |
-
return result
|
| 49 |
|
| 50 |
if st.button('Predict'):
|
| 51 |
-
predicted_class_label, predicted_prob =
|
| 52 |
prediction_text = f'Prediction: {predicted_class_label} ({predicted_prob:.2f})'
|
| 53 |
st.write(prediction_text)
|
| 54 |
predictions = {tweet: (predicted_class_label, predicted_prob)}
|
|
|
|
| 40 |
st.title('Toxicity Prediction App')
|
| 41 |
tweet=st.text_input('Enter a tweet to check for toxicity')
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
if st.button('Predict'):
|
| 45 |
+
predicted_class_label, predicted_prob = prediction(tweet, model, tokenizer))
|
| 46 |
prediction_text = f'Prediction: {predicted_class_label} ({predicted_prob:.2f})'
|
| 47 |
st.write(prediction_text)
|
| 48 |
predictions = {tweet: (predicted_class_label, predicted_prob)}
|