TheoLvs commited on
Commit
a535f72
·
1 Parent(s): d459c7a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from setfit import SetFitModel
3
+
4
+ # Download from Hub and run inference
5
+ model = SetFitModel.from_pretrained("eclaircies/ecolo-pas-ecolo-v0.1")
6
+
7
+ # Labels
8
+ labels = ['pas écolo', 'ça dépend', 'écolo']
9
+
10
+ def greet(name):
11
+ preds = int(model([x]).detach().numpy())
12
+ return labels[preds]
13
+
14
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
15
+ iface.launch()