Chatop commited on
Commit
6525040
1 Parent(s): 749ee6b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """Lab10_app.ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/17s4mJEUqE6OCVbdAOw1ROMQOpf4NBAw1
8
+ """
9
+
10
+ import streamlit as st
11
+ from transformers import pipeline
12
+
13
+ classifier = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
14
+ def main():
15
+ st.title("Sentiment analysis")
16
+
17
+ with st.form("text_field"):
18
+ text = st.text_area('enter some text:')
19
+ # clicked==True only when the button is clicked
20
+ clicked = st.form_submit_button("Submit")
21
+ if clicked:
22
+ results = classifier([text])
23
+ st.json(results)
24
+
25
+ if __name__ == "__main__":
26
+ main()