vision2040 / app.py
aaboelmal's picture
initial version of the application
9c65b46
raw
history blame
474 Bytes
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()