Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import torch
|
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
5 |
import random as r
|
6 |
import gradio as gr
|
|
|
7 |
|
8 |
gr.Interface.load("models/APJ23/MultiHeaded_Sentiment_Analysis_Model").launch()
|
9 |
|
@@ -38,6 +39,9 @@ def create_table(predictions):
|
|
38 |
|
39 |
st.title('Toxicity Prediction App')
|
40 |
tweet=st.text_input('Enter a tweet to check for toxicity')
|
|
|
|
|
|
|
41 |
if st.button('Predict'):
|
42 |
predicted_class_label, predicted_prob = predict_toxicity(tweet, model, tokenizer)
|
43 |
prediction_text = f'Prediction: {predicted_class_label} ({predicted_prob:.2f})'
|
|
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
5 |
import random as r
|
6 |
import gradio as gr
|
7 |
+
import asyncio
|
8 |
|
9 |
gr.Interface.load("models/APJ23/MultiHeaded_Sentiment_Analysis_Model").launch()
|
10 |
|
|
|
39 |
|
40 |
st.title('Toxicity Prediction App')
|
41 |
tweet=st.text_input('Enter a tweet to check for toxicity')
|
42 |
+
async def run_async_function():
|
43 |
+
result = await prediction(tweet, model, tokenizer)
|
44 |
+
return result
|
45 |
if st.button('Predict'):
|
46 |
predicted_class_label, predicted_prob = predict_toxicity(tweet, model, tokenizer)
|
47 |
prediction_text = f'Prediction: {predicted_class_label} ({predicted_prob:.2f})'
|