Update app.py
Browse files
app.py
CHANGED
@@ -173,18 +173,30 @@ def infer(frameA, frameB):
|
|
173 |
|
174 |
return "predicted_flow.jpg", ["flofile.flo"]
|
175 |
|
|
|
176 |
description="<p style='text-align:center'>PyTorch way to Generate optical flow image & .flo file from 2 consecutive frames with RAFT model</p>"
|
177 |
|
178 |
-
gr.
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
return "predicted_flow.jpg", ["flofile.flo"]
|
175 |
|
176 |
+
title="RAFT Optical Flow"
|
177 |
description="<p style='text-align:center'>PyTorch way to Generate optical flow image & .flo file from 2 consecutive frames with RAFT model</p>"
|
178 |
|
179 |
+
with gr.Blocks() as block:
|
180 |
+
with gr.Column(elem_id="col-container"):
|
181 |
+
gr.HTML(title)
|
182 |
+
gr.HTML(description)
|
183 |
+
|
184 |
+
frame1_inp = gr.Image(source="upload", type="filepath", label="frame 1")
|
185 |
+
frame2_inp = gr.Image(source="upload", type="filepath", label="frame 2")]
|
186 |
+
|
187 |
+
submit_btn = gr.Button("Submit")
|
188 |
+
|
189 |
+
flow_img_out = gr.Image(label="flow image")
|
190 |
+
flow_file_out = gr.Files(label="flow file")]
|
191 |
+
|
192 |
+
|
193 |
+
examples=[['basket1.jpg'], ['basket2.jpg']]
|
194 |
+
ex = gr.Examples(examples=examples, fn=infer, inputs=[frame1_inp, frame2_inp], outputs=[flow_img_out, flow_file_out], cache_examples=True, run_on_click=True)
|
195 |
+
ex.dataset.headers = [""]
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
submit_btn.click(fn=infer, inputs=[frame1_inp, frame2_inp], outputs=[flow_img_out, flow_file_out])
|
200 |
+
|
201 |
+
|
202 |
+
block.launch()
|