Spaces:
Runtime error
Runtime error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.text.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn.load_learner('export.pkl')
|
5 |
+
|
6 |
+
categories = ('Negative', 'Positive')
|
7 |
+
label = gr.outputs.Label()
|
8 |
+
def classify(text):
|
9 |
+
pred,pred_idx,probs = learn.predict(text)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
|
13 |
+
intf = gr.Interface(fn=classify,inputs="text", outputs=label).launch(share=True)
|