ntsc207 commited on
Commit
9d353b9
·
verified ·
1 Parent(s): dfc0d9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -19
app.py CHANGED
@@ -119,15 +119,28 @@ def app():
119
  with gr.Row():
120
  with gr.Column():
121
  gr.HTML("<h2>Input Parameters</h2>")
122
- img_path = gr.Image(label="Image", height = 370, width = 600)
123
- vid_path = gr.Video(label="Video", height = 370, width = 600)
 
 
 
 
 
 
 
 
 
 
 
 
124
  model_id = gr.Dropdown(
125
- label="Model",
126
- choices=[
127
- "Our_Model.pt",
128
- "yolov9_e_trained.pt"
129
- ],
130
- value="Our_Model.pt"
 
131
  )
132
  tracking_algorithm = gr.Dropdown(
133
  label= "Tracking Algorithm",
@@ -139,16 +152,9 @@ def app():
139
  value="None"
140
  )
141
  yolov9_infer = gr.Button(value="Inference")
142
- gr.Examples(['./img_examples/Exam_1.png','./img_examples/Exam_2.png','./img_examples/Exam_3.png','./img_examples/Exam_4.png','./img_examples/Exam_5.png'], inputs=img_path,label = "Image Example", cache_examples = False)
143
- gr.Examples(['./video_examples/video_1.mp4', './video_examples/video_2.mp4','./video_examples/video_3.mp4','./video_examples/video_4.mp4','./video_examples/video_5.mp4'], inputs=vid_path, label = "Video Example", cache_examples = False)
144
- with gr.Column():
145
- gr.HTML("<h2>Output</h2>")
146
- output_image = gr.Image(type="numpy",label="Output")
147
- #df = gr.BarPlot(show_label=False, x="label", y="counts", x_title="Labels", y_title="Counts", vertical=False)
148
- output_video = gr.Video(label="Output")
149
- #frame_counts_df = gr.LinePlot(show_label=False, x="frame", y="count", x_title="Frame", y_title="Counts", color="label")
150
- fig = gr.Plot(label = "Plot")
151
- #output_path = gr.Textbox(label="Output path")
152
 
153
 
154
  yolov9_infer.click(
@@ -162,7 +168,6 @@ def app():
162
  outputs=[output_image, output_video, fig],
163
  )
164
 
165
-
166
  gradio_app = gr.Blocks()
167
  with gradio_app:
168
  gr.HTML(
 
119
  with gr.Row():
120
  with gr.Column():
121
  gr.HTML("<h2>Input Parameters</h2>")
122
+ img_path = gr.Image(label="Image", height = 260, width = 410)
123
+ vid_path = gr.Video(label="Video", height = 260, width = 410)
124
+ #gr.Examples(['./img_examples/Exam_1.png','./img_examples/Exam_2.png','./img_examples/Exam_3.png','./img_examples/Exam_4.png','./img_examples/Exam_5.png'], inputs=img_path,label = "Image Example", cache_examples = False)
125
+ #gr.Examples(['./video_examples/video_1.mp4', './video_examples/video_2.mp4','./video_examples/video_3.mp4','./video_examples/video_4.mp4','./video_examples/video_5.mp4'], inputs=vid_path, label = "Video Example", cache_examples = False)
126
+ with gr.Column(min_width = 270):
127
+ gr.HTML("<h2>Output</h2>")
128
+ output_image = gr.Image(type="numpy",label="Output", height = 260, width = 410)
129
+ #df = gr.BarPlot(show_label=False, x="label", y="counts", x_title="Labels", y_title="Counts", vertical=False)
130
+ output_video = gr.Video(label="Output", height = 260, width = 410)
131
+ #frame_counts_df = gr.LinePlot(show_label=False, x="frame", y="count", x_title="Frame", y_title="Counts", color="label")
132
+ fig = gr.Plot(label = "label")
133
+ #output_path = gr.Textbox(label="Output path")
134
+ with gr.Column():
135
+ gr.HTML("<h2>Example, Model and Tracking Algorithm</h2>")
136
  model_id = gr.Dropdown(
137
+ label="Model",
138
+ choices=[
139
+ "our-converted.pt",
140
+ "last_best_model.pt"
141
+ ],
142
+ value="our-converted.pt"
143
+
144
  )
145
  tracking_algorithm = gr.Dropdown(
146
  label= "Tracking Algorithm",
 
152
  value="None"
153
  )
154
  yolov9_infer = gr.Button(value="Inference")
155
+ gr.Examples(['./img_examples/Exam_1.png','./img_examples/Exam_2.png','./img_examples/Exam_3.png','./img_examples/Exam_4.png','./img_examples/Exam_5.png'], inputs=img_path,label = "Image Example", cache_examples = False, examples_per_page = 3)
156
+ gr.Examples(['./video_examples/video_1.mp4', './video_examples/video_2.mp4','./video_examples/video_3.mp4','./video_examples/video_4.mp4','./video_examples/video_5.mp4'], inputs=vid_path, label = "Video Example", cache_examples = False, examples_per_page = 3)
157
+
 
 
 
 
 
 
 
158
 
159
 
160
  yolov9_infer.click(
 
168
  outputs=[output_image, output_video, fig],
169
  )
170
 
 
171
  gradio_app = gr.Blocks()
172
  with gradio_app:
173
  gr.HTML(