awesome / gradio.py
tugot17's picture
Upload gradio.py
c1e91ac
import gradio as gr
from transformers import pipeline
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()