Shivdutta commited on
Commit
b376db3
1 Parent(s): b937099

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ def inference(input_img):
8
  temp = uuid.uuid4()
9
  shell = f"python yolov9/detect.py --source {input_img} --img 640 --device cpu --weights yolov9/runs/train/exp/weights/best.pt --name {temp}"
10
  os.system(shell)
11
- return Image.open(f"yolov9/runs/detect/{temp}/{input_img.split('/')[-1]}")
12
  #return "yolov9/runs/detect/f807164a-496b-413c-bb47-f5daf8803dcd/cut_a_1.mp4"
13
 
14
  def inference_video(input_img):
@@ -43,7 +43,7 @@ with gr.Blocks() as demo:
43
  )
44
  with gr.Row():
45
  img_input = [gr.Image(type="filepath",label="Input Image",width=300, height=300)]
46
- pred_outputs = [gr.Image(type="pil",label="Output Image",width=640, height=640)]
47
 
48
  image_button = gr.Button("Predict")
49
  image_button.click(inference, inputs=img_input, outputs=pred_outputs)
 
8
  temp = uuid.uuid4()
9
  shell = f"python yolov9/detect.py --source {input_img} --img 640 --device cpu --weights yolov9/runs/train/exp/weights/best.pt --name {temp}"
10
  os.system(shell)
11
+ return f"yolov9/runs/detect/{temp}/{input_img.split('/')[-1]}"
12
  #return "yolov9/runs/detect/f807164a-496b-413c-bb47-f5daf8803dcd/cut_a_1.mp4"
13
 
14
  def inference_video(input_img):
 
43
  )
44
  with gr.Row():
45
  img_input = [gr.Image(type="filepath",label="Input Image",width=300, height=300)]
46
+ pred_outputs = [gr.Image(label="Output Image",width=640, height=640)]
47
 
48
  image_button = gr.Button("Predict")
49
  image_button.click(inference, inputs=img_input, outputs=pred_outputs)