Spaces:
Sleeping
Sleeping
initial version of the application
Browse files- app.py +14 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load pre-trained model and tokenizer from Hugging Face
|
5 |
+
model_name = "aubmindlab/bert-base-arabertv02-twitter"
|
6 |
+
sentiment_analysis = pipeline("sentiment-analysis", model=model_name)
|
7 |
+
|
8 |
+
def analyze_sentiment(text):
|
9 |
+
result = sentiment_analysis(text)
|
10 |
+
return result
|
11 |
+
|
12 |
+
# Define Gradio interface
|
13 |
+
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Arabic Sentiment Analysis")
|
14 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
gradio
|