PolarisFTL commited on
Commit
e0e2576
·
verified ·
1 Parent(s): 31dbc58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -19
app.py CHANGED
@@ -6,9 +6,6 @@ from tqdm import tqdm
6
 
7
  yolo = YOLO()
8
 
9
- img_folder = "img/"
10
- img_files = [os.path.join(img_folder, file) for file in os.listdir(img_folder) if file.endswith(('.png', '.jpg', '.jpeg'))]
11
-
12
  def predict_single_image(image, crop=False, count=True):
13
  try:
14
  r_image = yolo.detect_image(image, crop=crop, count=count)
@@ -16,25 +13,10 @@ def predict_single_image(image, crop=False, count=True):
16
  except Exception as e:
17
  return str(e)
18
 
19
- def select_image(image_path):
20
- image = Image.open(image_path)
21
- return image
22
-
23
- # with gr.Blocks() as iface:
24
- # with gr.Row():
25
- # with gr.Column():
26
- # selected_image = gr.Image(label="Selected Image", width=600, height=400)
27
- # img_selector = gr.Dropdown(choices=img_files, label="Select an image from folder")
28
- # img_selector.change(select_image, img_selector, selected_image)
29
- # with gr.Column():
30
- # output_image = gr.Image(label="Output Image", width=600, height=400)
31
- # predict_button = gr.Button("Predict")
32
- # predict_button.click(predict_single_image, inputs=selected_image, outputs=output_image)
33
-
34
  demo = gr.Interface(
35
  fn=predict_single_image,
36
  inputs=[
37
- gr.Image(value="img/1.png", type="pil", label="Input"),
38
  ],
39
 
40
  outputs=gr.Image(label="Detection Images",
 
6
 
7
  yolo = YOLO()
8
 
 
 
 
9
  def predict_single_image(image, crop=False, count=True):
10
  try:
11
  r_image = yolo.detect_image(image, crop=crop, count=count)
 
13
  except Exception as e:
14
  return str(e)
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  demo = gr.Interface(
17
  fn=predict_single_image,
18
  inputs=[
19
+ gr.Image(value="img/1.png", type="pil", label="Input Images"),
20
  ],
21
 
22
  outputs=gr.Image(label="Detection Images",