File size: 399 Bytes
a535f72
 
 
 
cc58e32
a535f72
 
 
 
07f05b1
 
a535f72
 
07f05b1
a535f72
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from setfit import SetFitModel

# Download from Hub and run inference
model = SetFitModel.from_pretrained("eclaircies/ecolo-pas-ecolo-v0.2")

# Labels
labels = ['pas écolo', 'ça dépend', 'écolo']

def predict(concept):
    preds = int(model([concept]).detach().numpy())
    return labels[preds] 

iface = gr.Interface(fn=predict, inputs="text", outputs="text")
iface.launch()