APJ23 commited on
Commit
cadcfc5
1 Parent(s): 2153f35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -7
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 = asyncio.run(run_async_function(tweet, model, tokenizer))
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)}