File size: 563 Bytes
c1e91ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()