Spaces:
Sleeping
Sleeping
File size: 474 Bytes
9c65b46 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
from transformers import pipeline
# Load pre-trained model and tokenizer from Hugging Face
model_name = "aubmindlab/bert-base-arabertv02-twitter"
sentiment_analysis = pipeline("sentiment-analysis", model=model_name)
def analyze_sentiment(text):
result = sentiment_analysis(text)
return result
# Define Gradio interface
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Arabic Sentiment Analysis")
iface.launch()
|