Spaces:
Sleeping
Sleeping
Update app.py
Browse filesRemove flask function
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
-
from flask import jsonify
|
4 |
|
5 |
# Load pre-trained model and tokenizer from Hugging Face
|
6 |
#model_name = "aubmindlab/bert-base-arabertv02-twitter"
|
@@ -11,10 +11,11 @@ def analyze_sentiment(text):
|
|
11 |
#result = sentiment_analysis(text)
|
12 |
#return result
|
13 |
result = sentiment_analysis(text)[0]
|
14 |
-
return jsonify({
|
15 |
"sentiment": result['label'],
|
16 |
"confidence": result['score']
|
17 |
-
})
|
|
|
18 |
|
19 |
# Define Gradio interface
|
20 |
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Arabic Sentiment Analysis")
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
#from flask import jsonify
|
4 |
|
5 |
# Load pre-trained model and tokenizer from Hugging Face
|
6 |
#model_name = "aubmindlab/bert-base-arabertv02-twitter"
|
|
|
11 |
#result = sentiment_analysis(text)
|
12 |
#return result
|
13 |
result = sentiment_analysis(text)[0]
|
14 |
+
"""return jsonify({
|
15 |
"sentiment": result['label'],
|
16 |
"confidence": result['score']
|
17 |
+
})"""
|
18 |
+
return result
|
19 |
|
20 |
# Define Gradio interface
|
21 |
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Arabic Sentiment Analysis")
|