File size: 599 Bytes
6d8bb66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline

model_name = "ieuniversity/flirty_classifier"
classifier = pipeline("text-classification", model=model_name)

def classify_text(text):
    output = classifier(text)
    label = output[0]["label"]
    score = output[0]["score"]
    return f"Label: {label}, Score: {score:.2f}"

gr.Interface(fn=classify_text, 
                     inputs="text", 
                     outputs="text",
                     title="Flirty Classifier",
                     description="Enter some text and get a prediction for whether it's flirty or not.").launch()