Spaces:
Sleeping
Sleeping
File size: 956 Bytes
f294c70 1014652 f294c70 1014652 32c1c21 1014652 32c1c21 1014652 |
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 33 34 35 |
import gradio as gr
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained("gsar78/Greek_Sentiment")
tokenizer = AutoTokenizer.from_pretrained("gsar78/Greek_Sentiment")
def predict(text):
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
scores = torch.nn.functional.softmax(outputs.logits, dim=1)
return {"Positive": scores[:, 1].item(), "Negative": scores[:, 0].item()}
iface = gr.Interface(
fn=predict,
inputs="text",
outputs="label",
title="Hellenic Sentiment AI",
description=None,
article=None,
theme="default",
flagging_dir=None,
share=True,
favicon_path=None,
css=None,
analytics_script=None,
allow_flagging="never",
allow_screenshot=True,
enable_queue=True,
show_input=True,
show_output=True,
footer="Development by Geo Sar"
)
iface.launch() |