nickmuchi commited on
Commit
c4bed8c
1 Parent(s): 70ae0a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -63,9 +63,12 @@ def detect_objects(model_name,url,image_upload,threshold):
63
  elif 'yolos' in model_name:
64
 
65
  model = YolosForObjectDetection.from_pretrained(model_name)
 
 
66
 
67
- if validators.url(url):
68
- image = Image.open(requests.get(url, stream=True).raw)
 
69
  elif image_upload:
70
  image = image_upload
71
 
@@ -105,14 +108,14 @@ with demo:
105
  slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.7,label='Prediction Threshold')
106
 
107
  with gr.Tabs():
108
- with gr.Tabitem('Image URL'):
109
  with gr.Row():
110
  url_input = gr.Textbox(lines=1,label='Enter valid image URL here..')
111
  img_output_from_url = gr.Image(shape=(450,450))
112
 
113
  url_but = gr.Button('Detect')
114
 
115
- with gr.Tabitem('Image Upload'):
116
  with gr.Row():
117
  img_input = gr.Image(type='pil')
118
  img_output_from_upload= gr.Image(shape=(450,450))
 
63
  elif 'yolos' in model_name:
64
 
65
  model = YolosForObjectDetection.from_pretrained(model_name)
66
+
67
+ if url:
68
 
69
+ if validators.url(url):
70
+ image = Image.open(requests.get(url, stream=True).raw)
71
+
72
  elif image_upload:
73
  image = image_upload
74
 
 
108
  slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.7,label='Prediction Threshold')
109
 
110
  with gr.Tabs():
111
+ with gr.TabItem('Image URL'):
112
  with gr.Row():
113
  url_input = gr.Textbox(lines=1,label='Enter valid image URL here..')
114
  img_output_from_url = gr.Image(shape=(450,450))
115
 
116
  url_but = gr.Button('Detect')
117
 
118
+ with gr.TabItem('Image Upload'):
119
  with gr.Row():
120
  img_input = gr.Image(type='pil')
121
  img_output_from_upload= gr.Image(shape=(450,450))