awesome / app.py
tugot17's picture
Update app.py
e85afcc
import gradio as gr
from transformers import pipeline
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
classifier = pipeline("text-classification", model="tugot17/my-awesome-model", tokenizer=tokenizer)
def predict(text):
output = {}
for result in classifier(text, top_k=None):
output[result["label"]] = result["score"]
return output
iface = gr.Interface(
fn=predict,
inputs='text',
outputs=gr.Label(num_top_classes=2),
examples=[["SIX chances to win CASH! From 100 to 20,000 pounds txt> CSH11 and send to 87575. Cost 150p/day, 6days, 16+ TsandCs apply Reply HL 4 info"]]
)
iface.launch()