Update app.py
Browse files
app.py
CHANGED
@@ -50,32 +50,31 @@ def resize_img(img1, img2_path):
|
|
50 |
)
|
51 |
img_to_resize.save('resized_img2.png')
|
52 |
|
53 |
-
def predict(frame1, frame2,
|
54 |
model = models[model_name]
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
interpolated_frames.extend(
|
67 |
-
util.interpolate_recursively_from_files(
|
68 |
-
input_frames, times_to_interpolate, model))
|
69 |
|
70 |
-
mediapy.write_video("out.mp4",
|
71 |
return "out.mp4"
|
72 |
|
73 |
title = "Sports model"
|
74 |
description = "Wechat:Liesle1"
|
75 |
article = ""
|
76 |
examples = [
|
77 |
-
['cat3.jpeg', 'cat4.jpeg',
|
78 |
-
['cat1.jpeg', 'cat2.jpeg',
|
79 |
]
|
80 |
|
81 |
gr.Interface(
|
@@ -83,8 +82,6 @@ gr.Interface(
|
|
83 |
inputs=[
|
84 |
gr.Image(label="First Frame"),
|
85 |
gr.Image(label="Second Frame"),
|
86 |
-
gr.Image(label="Third Frame"),
|
87 |
-
gr.Image(label="Fourth Frame"),
|
88 |
gr.Number(label="Times to Interpolate", value=2),
|
89 |
gr.Dropdown(label="Model", choices=model_names),
|
90 |
],
|
@@ -93,4 +90,4 @@ gr.Interface(
|
|
93 |
description=description,
|
94 |
article=article,
|
95 |
examples=examples,
|
96 |
-
).launch()
|
|
|
50 |
)
|
51 |
img_to_resize.save('resized_img2.png')
|
52 |
|
53 |
+
def predict(frame1, frame2, times_to_interpolate, model_name):
|
54 |
model = models[model_name]
|
55 |
|
56 |
+
frame1 = resize(1080, frame1)
|
57 |
+
frame2 = resize(1080, frame2)
|
58 |
|
59 |
+
frame1.save("test1.png")
|
60 |
+
frame2.save("test2.png")
|
61 |
|
62 |
+
resize_img("test1.png", "test2.png")
|
63 |
+
input_frames = ["test1.png", "resized_img2.png"]
|
64 |
|
65 |
+
frames = list(
|
66 |
+
util.interpolate_recursively_from_files(
|
67 |
+
input_frames, times_to_interpolate, model))
|
|
|
|
|
|
|
68 |
|
69 |
+
mediapy.write_video("out.mp4", frames, fps=30)
|
70 |
return "out.mp4"
|
71 |
|
72 |
title = "Sports model"
|
73 |
description = "Wechat:Liesle1"
|
74 |
article = ""
|
75 |
examples = [
|
76 |
+
['cat3.jpeg', 'cat4.jpeg', 2, model_names[0]],
|
77 |
+
['cat1.jpeg', 'cat2.jpeg', 2, model_names[1]],
|
78 |
]
|
79 |
|
80 |
gr.Interface(
|
|
|
82 |
inputs=[
|
83 |
gr.Image(label="First Frame"),
|
84 |
gr.Image(label="Second Frame"),
|
|
|
|
|
85 |
gr.Number(label="Times to Interpolate", value=2),
|
86 |
gr.Dropdown(label="Model", choices=model_names),
|
87 |
],
|
|
|
90 |
description=description,
|
91 |
article=article,
|
92 |
examples=examples,
|
93 |
+
).launch()
|