Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -249,7 +249,8 @@ def encode_img_fn(img):
|
|
249 |
def gen_video_fn(w1, w2, frame):
|
250 |
if w1 is None or w2 is None:
|
251 |
return None
|
252 |
-
model.gen_video(np.array(json.loads(w1), dtype=np.float32), np.array(json.loads(w2), dtype=np.float32), "video.mp4",
|
|
|
253 |
return "video.mp4"
|
254 |
|
255 |
|
@@ -262,50 +263,62 @@ if __name__ == '__main__':
|
|
262 |
"the model is not good, just for fun.")
|
263 |
with gr.Tabs():
|
264 |
with gr.TabItem("generate image"):
|
265 |
-
with gr.
|
266 |
-
with gr.
|
|
|
267 |
gen_input1 = gr.Checkbox(value=False, label="use seed")
|
268 |
gen_input2 = gr.Number(value=1, label="seed")
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
274 |
|
275 |
with gr.TabItem("encode image"):
|
276 |
-
with gr.
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
285 |
|
286 |
with gr.TabItem("generate video"):
|
287 |
-
with gr.
|
288 |
-
gr.
|
289 |
-
|
290 |
-
with gr.
|
291 |
-
gr.
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
gen_submit.click(gen_fn, [gen_input1, gen_input2, gen_input3],
|
311 |
[gen_output1, select_img_input_w1, select_img_input_img1])
|
|
|
249 |
def gen_video_fn(w1, w2, frame):
|
250 |
if w1 is None or w2 is None:
|
251 |
return None
|
252 |
+
model.gen_video(np.array(json.loads(w1), dtype=np.float32), np.array(json.loads(w2), dtype=np.float32), "video.mp4",
|
253 |
+
int(frame))
|
254 |
return "video.mp4"
|
255 |
|
256 |
|
|
|
263 |
"the model is not good, just for fun.")
|
264 |
with gr.Tabs():
|
265 |
with gr.TabItem("generate image"):
|
266 |
+
with gr.Row():
|
267 |
+
with gr.Column():
|
268 |
+
gr.Markdown("generate image randomly or by seed")
|
269 |
gen_input1 = gr.Checkbox(value=False, label="use seed")
|
270 |
gen_input2 = gr.Number(value=1, label="seed")
|
271 |
+
gen_input3 = gr.Slider(minimum=0, maximum=1, step=0.01, value=0.6, label="truncation psi")
|
272 |
+
with gr.Group():
|
273 |
+
gen_submit = gr.Button("Run")
|
274 |
+
with gr.Column():
|
275 |
+
gen_output1 = gr.Image()
|
276 |
+
select_img_input_w1 = gr.Textbox(visible=False)
|
277 |
+
select_img_input_img1 = gr.Image(visible=False)
|
278 |
|
279 |
with gr.TabItem("encode image"):
|
280 |
+
with gr.Row():
|
281 |
+
with gr.Column():
|
282 |
+
gr.Markdown("you'd better upload a standing full-body image")
|
283 |
+
encode_img_input = gr.Image()
|
284 |
+
with gr.Group():
|
285 |
+
encode_img_submit = gr.Button("Run")
|
286 |
+
with gr.Column():
|
287 |
+
encode_img_output1 = gr.Textbox(label="message")
|
288 |
+
with gr.Row():
|
289 |
+
encode_img_output2 = gr.Image(label="detected")
|
290 |
+
encode_img_output3 = gr.Image(label="encoded")
|
291 |
+
select_img_input_w2 = gr.Textbox(visible=False)
|
292 |
+
select_img_input_img2 = gr.Image(visible=False)
|
293 |
|
294 |
with gr.TabItem("generate video"):
|
295 |
+
with gr.Row():
|
296 |
+
with gr.Column():
|
297 |
+
gr.Markdown("## generate video between 2 images")
|
298 |
+
with gr.Row():
|
299 |
+
with gr.Column():
|
300 |
+
gr.Markdown("please select image 1")
|
301 |
+
select_img1_dropdown = gr.Radio(label="source",
|
302 |
+
choices=["current generated image",
|
303 |
+
"current encoded image"], type="index")
|
304 |
+
with gr.Group():
|
305 |
+
select_img1_button = gr.Button("select")
|
306 |
+
select_img1_output_img = gr.Image(label="image 1")
|
307 |
+
select_img1_output_w = gr.Textbox(visible=False)
|
308 |
+
with gr.Column():
|
309 |
+
gr.Markdown("please select image 2")
|
310 |
+
select_img2_dropdown = gr.Radio(label="source",
|
311 |
+
choices=["current generated image",
|
312 |
+
"current encoded image"], type="index")
|
313 |
+
with gr.Group():
|
314 |
+
select_img2_button = gr.Button("select")
|
315 |
+
select_img2_output_img = gr.Image(label="image 2")
|
316 |
+
select_img2_output_w = gr.Textbox(visible=False)
|
317 |
+
generate_video_frame = gr.Slider(minimum=10, maximum=30, step=1, label="frame", value=10)
|
318 |
+
with gr.Group():
|
319 |
+
generate_video_button = gr.Button("generate")
|
320 |
+
with gr.Column():
|
321 |
+
generate_video_output = gr.Video()
|
322 |
|
323 |
gen_submit.click(gen_fn, [gen_input1, gen_input2, gen_input3],
|
324 |
[gen_output1, select_img_input_w1, select_img_input_img1])
|