TetherSST / app.py
SamanthaStorm's picture
Create app.py
865bd23 verified
raw
history blame
938 Bytes
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()