alperugurcan commited on
Commit
81e5634
·
verified ·
1 Parent(s): 121dc28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -1,9 +1,18 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
  pipe = pipeline('sentiment-analysis')
5
- text = gr.TextArea('enter some text!')
6
 
7
- if text:
8
- out = pipe(text)
9
- gr.json(out)
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load the sentiment analysis model
5
  pipe = pipeline('sentiment-analysis')
 
6
 
7
+ # Function to pass user input to the pipeline
8
+ def analyze_sentiment(input_text):
9
+ return pipe(input_text)
10
+
11
+ # Create the Gradio interface
12
+ demo = gr.Interface(
13
+ fn=analyze_sentiment,
14
+ inputs=gr.TextArea(label="Enter some text!"),
15
+ outputs=gr.JSON(label="Sentiment Result")
16
+ )
17
+
18
+ demo.launch()