cherryredddd commited on
Commit
01e807c
·
verified ·
1 Parent(s): 0ad642a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ sentiment_pipeline = pipeline("sentiment-analysis")
5
+
6
+ def get_sentiment(input_text):
7
+ result = sentiment_pipeline(input_text)
8
+ return result[0]['label']
9
+
10
+ #Launch the web UI
11
+ iface = gr.Interface(
12
+ fn = get_sentiment,
13
+ inputs = "text",
14
+ outputs = "text",
15
+ title = "My AI App",
16
+ description = "This is my first AI App !!!. Enter Some text and i will tell you the sentiment."
17
+ )
18
+ iface.launch()