ntsc207 commited on
Commit
905c48c
·
verified ·
1 Parent(s): 2de81c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -76,11 +76,11 @@ def yolov9_inference(model_id, img_path=None, vid_path=None, tracking_algorithm
76
  # Assuming output_path is the path to the output file
77
  _, output_extension = os.path.splitext(output_path)
78
  if output_extension.lower() in img_extensions:
79
- output = output_path # Load the image file here
80
  elif output_extension.lower() in vid_extensions:
81
- output = output_path # Load the video file here
82
 
83
- return output, output_path
84
 
85
 
86
  def app():
@@ -113,12 +113,8 @@ def app():
113
  yolov9_infer = gr.Button(value="Inference")
114
  with gr.Column():
115
  gr.HTML("<h2>Output</h2>")
116
- if img_path is not None:
117
- output_image = gr.Image(type="numpy",label="Output")
118
- output = output_image
119
- else:
120
- output_video = gr.Video(label="Output")
121
- output = output_video
122
  output_path = gr.Textbox(label="Output path")
123
 
124
  yolov9_infer.click(
@@ -129,7 +125,7 @@ def app():
129
  vid_path,
130
  tracking_algorithm
131
  ],
132
- outputs=[output, output_path],
133
  )
134
 
135
 
 
76
  # Assuming output_path is the path to the output file
77
  _, output_extension = os.path.splitext(output_path)
78
  if output_extension.lower() in img_extensions:
79
+ output_image = output_path # Load the image file here
80
  elif output_extension.lower() in vid_extensions:
81
+ output_video = output_path # Load the video file here
82
 
83
+ return output_image, output_video, output_path
84
 
85
 
86
  def app():
 
113
  yolov9_infer = gr.Button(value="Inference")
114
  with gr.Column():
115
  gr.HTML("<h2>Output</h2>")
116
+ output_image = gr.Image(type="numpy",label="Output")
117
+ output_video = gr.Video(label="Output")
 
 
 
 
118
  output_path = gr.Textbox(label="Output path")
119
 
120
  yolov9_infer.click(
 
125
  vid_path,
126
  tracking_algorithm
127
  ],
128
+ outputs=[output_image, output_video, output_path],
129
  )
130
 
131