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

# Load the classification pipeline from your model on the hub
classifier = pipeline("text-classification", model="PrimeQA/tydiqa-boolean-question-classifier")

def classify_text(text):
    results = classifier(text)
    # Format output nicely
    return {res["label"]: round(res["score"], 4) for res in results}

# Build Gradio UI
gr.Interface(
    fn=classify_text,
    inputs=gr.Textbox(lines=3, placeholder="Enter your text here..."),
    outputs="label",
    title="Boolean Classifier",
    description="A classification model by Mahmoud3899"
).launch()