yiw commited on
Commit
0ce8030
1 Parent(s): 21228f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,18 +1,16 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
- from PIL import Image
4
 
5
- classifier = pipeline("image-classification", model="google/vit-base-patch16-224-in21k")
6
  def main():
7
  st.title("text-classification")
8
 
9
  with st.form("text_field"):
10
- text = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
11
  # clicked==True only when the button is clicked
12
  clicked = st.form_submit_button("Submit")
13
  if clicked:
14
- img=Image.open(text)
15
- results = classifier([img])
16
  st.json(results)
17
 
18
  if __name__ == "__main__":
 
1
  import streamlit as st
2
  from transformers import pipeline
 
3
 
4
+ classifier = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
5
  def main():
6
  st.title("text-classification")
7
 
8
  with st.form("text_field"):
9
+ text = st.text_area('enter some text:')
10
  # clicked==True only when the button is clicked
11
  clicked = st.form_submit_button("Submit")
12
  if clicked:
13
+ results = classifier([text])
 
14
  st.json(results)
15
 
16
  if __name__ == "__main__":