Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the classification pipeline from your model on the hub
|
5 |
+
classifier = pipeline("text-classification", model="Mahmoud3899/Boolean_new")
|
6 |
+
|
7 |
+
def classify_text(text):
|
8 |
+
results = classifier(text)
|
9 |
+
# Format output nicely
|
10 |
+
return {res["label"]: round(res["score"], 4) for res in results}
|
11 |
+
|
12 |
+
# Build Gradio UI
|
13 |
+
gr.Interface(
|
14 |
+
fn=classify_text,
|
15 |
+
inputs=gr.Textbox(lines=3, placeholder="Enter your text here..."),
|
16 |
+
outputs="label",
|
17 |
+
title="Boolean Classifier",
|
18 |
+
description="A classification model by Mahmoud3899"
|
19 |
+
).launch()
|