tafxle commited on
Commit
047c577
1 Parent(s): 25ada91
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -1,5 +1,27 @@
 
 
 
 
 
 
 
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- text = st.text_area("Prefix", value="DM: You enter the room.")
4
- batch = st.number_input("Variants", value=5)
5
- st.markdown(f"{text} {batch}")
 
1
+ # import streamlit as st
2
+
3
+ # text = st.text_area("Prefix", value="DM: You enter the room.")
4
+ # batch = st.number_input("Variants", value=5)
5
+ # st.markdown(f"{text} {batch}")
6
+
7
+
8
  import streamlit as st
9
+ from transformers import pipeline
10
+ from PIL import Image
11
+
12
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
13
+
14
+ st.title("Hot Dog? Or Not?")
15
+
16
+ file_name = st.file_uploader("Upload a hot dog candidate image")
17
+
18
+ if file_name is not None:
19
+ col1, col2 = st.columns(2)
20
+
21
+ image = Image.open(file_name)
22
+ col1.image(image, use_column_width=True)
23
+ predictions = pipeline(image)
24
 
25
+ col2.header("Probabilities")
26
+ for p in predictions:
27
+ col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")