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()