seemapatil commited on
Commit
661ff60
·
1 Parent(s): f2fdc64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,8 +1,12 @@
1
  import streamlit as st
 
2
  from transformers import pipeline
3
  pipe = pipeline ('sentiment-analysis')
4
  text = st.text_area('enter some text!')
5
- if text:
6
- out = pipe(text)
7
- st.json(out)
8
- streamlit run app.py
 
 
 
 
1
  import streamlit as st
2
+ import gradio as gr
3
  from transformers import pipeline
4
  pipe = pipeline ('sentiment-analysis')
5
  text = st.text_area('enter some text!')
6
+ def predict_sentiment(text):
7
+ result = pipe(text)[0]
8
+ return result['label']
9
+
10
+
11
+ iface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text")
12
+ iface.launch()