Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification | |
def analyze_text(text): | |
try: | |
tokenizer = AutoTokenizer.from_pretrained("avichr/heBERT_sentiment_analysis") | |
model = AutoModelForSequenceClassification.from_pretrained("avichr/heBERT_sentiment_analysis") | |
classifier = pipeline( | |
"sentiment-analysis", | |
model=model, | |
tokenizer=tokenizer | |
) | |
result = classifier(text) | |
return str(result) | |
except Exception as e: | |
return f"Error: {str(e)}" | |
interface = gr.Interface( | |
fn=analyze_text, | |
inputs=gr.Textbox(label="讛讻谞住 讟拽住讟 讘注讘专讬转"), | |
outputs=gr.Textbox(label="转讜爪讗讛"), | |
title="谞讬转讜讞 专讙砖讜转 讘注讘专讬转" | |
) | |
interface.launch() |