firuiz commited on
Commit
69e30e0
·
1 Parent(s): c0e7b59

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import from_pretrained_fastai
2
+ import gradio as gr
3
+ from fastai.text.all import *
4
+
5
+ learner = load_learner("entrega")
6
+ labels = list(range(0,150))
7
+
8
+
9
+ def predict(text):
10
+ pred,pred_idx,probs = learner.predict(text)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+
14
+ gr.Interface(fn=predict, inputs="text", outputs=gr.outputs.Label(num_top_classes=5)).launch(share=False)