new_space_bool2 / app.py
Mahmoud3899's picture
Update app.py
cdea908 verified
raw
history blame contribute delete
612 Bytes
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()