Sarah Yakum commited on
Commit
b7bc15f
1 Parent(s): a1ef97d

Add application file

Browse files
Files changed (2) hide show
  1. app.py +20 -2
  2. requirements.txt +2 -0
app.py CHANGED
@@ -1,4 +1,22 @@
1
  import streamlit as st
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x*x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ import streamlit as st
4
+ from transformers import pipeline
5
+ from PIL import Image
6
+
7
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
8
+
9
+ st.title("Hot Dog? Or Not?")
10
+
11
+ file_name = st.file_uploader("Upload a hot dog candidate image")
12
+
13
+ if file_name is not None:
14
+ col1, col2 = st.columns(2)
15
+
16
+ image = Image.open(file_name)
17
+ col1.image(image, use_column_width=True)
18
+ predictions = pipeline(image)
19
+
20
+ col2.header("Probabilities")
21
+ for p in predictions:
22
+ col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch