entregable3 / app.py
yejimene's picture
Update app.py
2c57611 verified
raw
history blame contribute delete
516 Bytes
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)