File size: 516 Bytes
575ffd8
e3292db
 
575ffd8
 
e3292db
 
2c57611
 
 
 
 
 
 
5959bdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from huggingface_hub import from_pretrained_fastai
import gradio as gr

repo_id = "yejimene/clasificadorTexto"
learner = from_pretrained_fastai(repo_id)

def predict(text):
    pred,pred_idx,probs = learner.predict(text)
    if (pred == "0"):
        return "Negative"
    elif (pred == "1"):
        return "Positive"
    else:
        return "Error"
gr.Interface(fn=predict, inputs="text", outputs="label", examples=["This movie was terrible and boring.","I loved this movie, it was amazing!"]).launch(share=False)