yiw commited on
Commit
4557b21
·
1 Parent(s): 4094273

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,15 +1,17 @@
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
 
 
1
  import streamlit as st
2
  from transformers import pipeline
3
+ from PIL import Image
4
 
5
  classifier = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
6
  def main():
7
  st.title("text-classification")
8
 
9
  with st.form("text_field"):
10
+ uploaded_file = st.file_uploader("Upload Files",type=['png','jpeg','jpg'])
11
  # clicked==True only when the button is clicked
12
  clicked = st.form_submit_button("Submit")
13
  if clicked:
14
+ img=Image.open(uploaded_file)
15
  results = classifier([text])
16
  st.json(results)
17