Kamaljp commited on
Commit
5e6070e
·
1 Parent(s): 967d059

pushing test app

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