msivanes commited on
Commit
62eaa9c
1 Parent(s): 067eecf
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from huggingface_hub import from_pretrained_fastai
4
+ from blurr.text.modeling.all import *
5
+
6
+ def predict(text):
7
+ repo_id = "msivanes/blurr_IMDB_distilbert_cls"
8
+ learn = from_pretrained_fastai(repo_id)
9
+ probs = learn.predict(text)
10
+ return f"Sentiment Prediction Confidence for the sentence '{text}' as positive is {100 * probs[0]['probs'][1]:.2f}%"
11
+
12
+ examples = ['This hack day is amazing', 'I hate the weather today.', 'Loved how Ryan started talking in gibberish language']
13
+
14
+ demo = gr.Interface(fn=predict, inputs=gr.Textbox(lines=3, label="Input Text"), outputs="text", title='DistiBERT Sentiment Classification', examples=examples)
15
+ demo.launch()