ayaanzaveri commited on
Commit
6452d66
1 Parent(s): 1e8df9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -17,19 +17,21 @@ from transformers import pipeline
17
 
18
  pipe = pipeline('object-detection', model=model, feature_extractor=extractor)
19
 
 
 
20
  img_url = st.text_input('Image URL', 'https://images.unsplash.com/photo-1556911220-bff31c812dba?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2468&q=80')
21
 
22
- st.caption('Downloading Image...')
23
 
24
  img_data = requests.get(img_url).content
25
  with open('detect.jpg', 'wb') as handler:
26
  handler.write(img_data)
27
 
28
- st.caption('Running Detection...')
29
 
30
  output = pipe(img_url)
31
 
32
- st.caption('Adding Predictions to Image...')
33
 
34
  fpath = "Poppins-SemiBold.ttf"
35
  prop = font_manager.FontProperties(fname=fpath)
@@ -63,4 +65,4 @@ st.image(image, caption='DETR Image')
63
 
64
  plt.show()
65
 
66
- st.caption('Done!')
 
17
 
18
  pipe = pipeline('object-detection', model=model, feature_extractor=extractor)
19
 
20
+ my_bar = st.progress(0)
21
+
22
  img_url = st.text_input('Image URL', 'https://images.unsplash.com/photo-1556911220-bff31c812dba?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2468&q=80')
23
 
24
+ my_bar.progress(percent_complete + 20)
25
 
26
  img_data = requests.get(img_url).content
27
  with open('detect.jpg', 'wb') as handler:
28
  handler.write(img_data)
29
 
30
+ my_bar.progress(percent_complete + 40)
31
 
32
  output = pipe(img_url)
33
 
34
+ my_bar.progress(percent_complete + 20)
35
 
36
  fpath = "Poppins-SemiBold.ttf"
37
  prop = font_manager.FontProperties(fname=fpath)
 
65
 
66
  plt.show()
67
 
68
+ my_bar.progress(percent_complete + 20)