aaboelmal commited on
Commit
5999611
·
verified ·
1 Parent(s): d356403

Update app.py

Browse files

Remove flask function

Files changed (1) hide show
  1. app.py +4 -3
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")