Spaces:
Runtime error
Runtime error
Commit
·
dbf707c
1
Parent(s):
1e82296
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,10 @@
|
|
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?")
|
@@ -19,4 +22,19 @@ if file_name is not None:
|
|
19 |
|
20 |
col2.header("Probabilities")
|
21 |
for p in predictions:
|
22 |
-
col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import streamlit as st
|
4 |
from transformers import pipeline
|
5 |
from PIL import Image
|
6 |
+
import time
|
7 |
|
8 |
+
|
9 |
+
'Starting a long computation...'
|
10 |
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
11 |
|
12 |
st.title("Hot Dog? Or Not?")
|
|
|
22 |
|
23 |
col2.header("Probabilities")
|
24 |
for p in predictions:
|
25 |
+
col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
26 |
+
|
27 |
+
|
28 |
+
# Add a placeholder
|
29 |
+
latest_iteration = st.empty()
|
30 |
+
bar = st.progress(0)
|
31 |
+
|
32 |
+
for i in range(100):
|
33 |
+
# Update the progress bar with each iteration.
|
34 |
+
latest_iteration.text(f'Iteration {i+1}')
|
35 |
+
bar.progress(i + 1)
|
36 |
+
time.sleep(0.1)
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
'...and now we\'re done!'
|