sunidhi7 commited on
Commit
61c4b3e
·
verified ·
1 Parent(s): 0ebd9b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -2
app.py CHANGED
@@ -1,7 +1,42 @@
 
 
1
  import streamlit as st
2
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
- x = st.slider('Select a value')
6
 
7
- st.write(x, 'squared is', x * x)
 
1
+
2
+
3
  import streamlit as st
4
 
5
 
6
+ from transformers import pipeline
7
+
8
+ from PIL import Image
9
+
10
+
11
+
12
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
13
+
14
+
15
+
16
+ st.title("AIMLJan24 First App on Hugging face - Hot Dog? Or Not?")
17
+
18
+
19
+
20
+ file_name = st.file_uploader("Upload the test image to find is this hot dog ! ")
21
+
22
+
23
+
24
+ if file_name is not None:
25
+
26
+ col1, col2 = st.columns(2)
27
+
28
+
29
+
30
+ image = Image.open(file_name)
31
+
32
+ col1.image(image, use_column_width=True)
33
+
34
+ predictions = pipeline(image)
35
+
36
+
37
+
38
+ col2.header("Probabilities")
39
 
40
+ for p in predictions:
41
 
42
+ col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")