Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,7 @@ def write_flo(flow, filename):
|
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
-
def infer():
|
| 71 |
#video_url = "https://download.pytorch.org/tutorial/pexelscom_pavel_danilyuk_basketball_hd.mp4"
|
| 72 |
#video_path = Path(tempfile.mkdtemp()) / "basketball.mp4"
|
| 73 |
#_ = urlretrieve(video_url, video_path)
|
|
@@ -76,9 +76,9 @@ def infer():
|
|
| 76 |
#print(f"FRAME BEFORE stack: {frames[100]}")
|
| 77 |
|
| 78 |
|
| 79 |
-
input_frame_1 = read_image(str(
|
| 80 |
print(f"FRAME 1: {input_frame_1}")
|
| 81 |
-
input_frame_2 = read_image(str(
|
| 82 |
print(f"FRAME 1: {input_frame_2}")
|
| 83 |
|
| 84 |
#img1_batch = torch.stack([frames[0]])
|
|
@@ -174,4 +174,4 @@ def infer():
|
|
| 174 |
return "done", "predicted_flow.jpg", ["flofile.flo"]
|
| 175 |
|
| 176 |
|
| 177 |
-
gr.Interface(fn=infer, inputs=[], outputs=[gr.Textbox(), gr.Image(label="flow"), gr.Files()]).launch()
|
|
|
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
+
def infer(frameA, frameB):
|
| 71 |
#video_url = "https://download.pytorch.org/tutorial/pexelscom_pavel_danilyuk_basketball_hd.mp4"
|
| 72 |
#video_path = Path(tempfile.mkdtemp()) / "basketball.mp4"
|
| 73 |
#_ = urlretrieve(video_url, video_path)
|
|
|
|
| 76 |
#print(f"FRAME BEFORE stack: {frames[100]}")
|
| 77 |
|
| 78 |
|
| 79 |
+
input_frame_1 = read_image(str(frameA), ImageReadMode.UNCHANGED)
|
| 80 |
print(f"FRAME 1: {input_frame_1}")
|
| 81 |
+
input_frame_2 = read_image(str(frameB), ImageReadMode.UNCHANGED)
|
| 82 |
print(f"FRAME 1: {input_frame_2}")
|
| 83 |
|
| 84 |
#img1_batch = torch.stack([frames[0]])
|
|
|
|
| 174 |
return "done", "predicted_flow.jpg", ["flofile.flo"]
|
| 175 |
|
| 176 |
|
| 177 |
+
gr.Interface(fn=infer, inputs=[gr.Image(source="upload", type="filepath", label="frame 1"), gr.Image(source="upload", type="filepath", label="frame 2")], outputs=[gr.Textbox(), gr.Image(label="flow"), gr.Files()]).launch()
|