Spaces:
Sleeping
Sleeping
File size: 938 Bytes
865bd23 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import gradio as gr
from transformers import pipeline
# Load SST sentiment model (adjust model name if different)
sst_classifier = pipeline(
"text-classification",
model="SamanthaStorm/tether-sst", # replace with your actual SST model name
top_k=None,
truncation=True
)
def classify_sentiment(text):
result = sst_classifier(text)[0]
label = result["label"]
score = round(result["score"] * 100, 2)
if label == "LABEL_0":
return f"Supportive ({score}%)"
elif label == "LABEL_1":
return f"Undermining ({score}%)"
else:
return f"Unknown label ({label})"
iface = gr.Interface(
fn=classify_sentiment,
inputs=gr.Textbox(lines=4, placeholder="Paste message here..."),
outputs="text",
title="Tether SST Sentiment Analyzer",
description="Classifies language as Supportive or Undermining based on tone and intent. Part of the Tether project."
)
iface.launch() |