ayaanzaveri commited on
Commit
df6c7a9
1 Parent(s): f899344

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -17,21 +17,19 @@ from transformers import pipeline
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(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(60)
31
 
32
  output = pipe(img_url)
33
 
34
- my_bar.progress(80)
35
 
36
  fpath = "Poppins-SemiBold.ttf"
37
  prop = font_manager.FontProperties(fname=fpath)
@@ -65,10 +63,4 @@ st.image(image, caption='DETR Image')
65
 
66
  plt.show()
67
 
68
- my_bar.progress(100)
69
-
70
- st.download_button(
71
- label="Download Image",
72
- data="detect-bbox.jpg",
73
- file_name='detect-bbox.jpg',
74
- )
 
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
 
64
  plt.show()
65
 
66
+ st.caption('Done!')