File size: 823 Bytes
46f5b7a
a97c162
46f5b7a
a97c162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46f5b7a
a97c162
 
 
 
 
46f5b7a
 
a97c162
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
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()