Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model_name = "ieuniversity/flirty_classifier"
|
5 |
+
classifier = pipeline("text-classification", model=model_name)
|
6 |
+
|
7 |
+
def classify_text(text):
|
8 |
+
output = classifier(text)
|
9 |
+
label = output[0]["label"]
|
10 |
+
score = output[0]["score"]
|
11 |
+
return f"Label: {label}, Score: {score:.2f}"
|
12 |
+
|
13 |
+
gr.Interface(fn=classify_text,
|
14 |
+
inputs="text",
|
15 |
+
outputs="text",
|
16 |
+
title="Flirty Classifier",
|
17 |
+
description="Enter some text and get a prediction for whether it's flirty or not.").launch()
|