skytnt commited on
Commit
62195aa
β€’
1 Parent(s): 122bee5

update sdkk

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +8 -9
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ˜‡
4
  colorFrom: red
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.9.1
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
4
  colorFrom: red
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.36.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
app.py CHANGED
@@ -282,7 +282,7 @@ if __name__ == '__main__':
282
  app = gr.Blocks()
283
  with app:
284
  gr.Markdown("# full-body anime GAN\n\n"
285
- "![visitor badge](https://visitor-badge.glitch.me/badge?page_id=skytnt.full-body-anime-gan)\n\n")
286
  with gr.Tabs():
287
  with gr.TabItem("generate image"):
288
  with gr.Row():
@@ -298,8 +298,8 @@ if __name__ == '__main__':
298
  gen_submit = gr.Button("Generate", variant="primary")
299
  with gr.Column():
300
  gen_output1 = gr.Image(label="output image")
301
- select_img_input_w1 = gr.Variable()
302
- select_img_input_img1 = gr.Variable()
303
 
304
  with gr.TabItem("encode image"):
305
  with gr.Row():
@@ -307,7 +307,7 @@ if __name__ == '__main__':
307
  gr.Markdown("you'd better upload a standing full-body image")
308
  encode_img_input = gr.Image(label="input image")
309
  examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 5)]
310
- encode_img_examples = gr.Dataset(components=[encode_img_input], samples=examples_data)
311
  with gr.Group():
312
  encode_img_submit = gr.Button("Run", variant="primary")
313
  with gr.Column():
@@ -315,8 +315,8 @@ if __name__ == '__main__':
315
  with gr.Row():
316
  encode_img_output2 = gr.Image(label="detected")
317
  encode_img_output3 = gr.Image(label="encoded")
318
- select_img_input_w2 = gr.Variable()
319
- select_img_input_img2 = gr.Variable()
320
 
321
  with gr.TabItem("generate video"):
322
  with gr.Row():
@@ -330,7 +330,7 @@ if __name__ == '__main__':
330
  with gr.Group():
331
  select_img1_button = gr.Button("Select", variant="primary")
332
  select_img1_output_img = gr.Image(label="selected image 1")
333
- select_img1_output_w = gr.Variable()
334
  with gr.Column():
335
  select_img2_dropdown = gr.Radio(label="Select image 2", value="current generated image",
336
  choices=["current generated image",
@@ -338,7 +338,7 @@ if __name__ == '__main__':
338
  with gr.Group():
339
  select_img2_button = gr.Button("Select", variant="primary")
340
  select_img2_output_img = gr.Image(label="selected image 2")
341
- select_img2_output_w = gr.Variable()
342
  generate_video_frame = gr.Slider(minimum=10, maximum=30, step=1, label="frame", value=15)
343
  with gr.Group():
344
  generate_video_button = gr.Button("Generate", variant="primary")
@@ -349,7 +349,6 @@ if __name__ == '__main__':
349
  encode_img_submit.click(encode_img_fn, [encode_img_input, gen_input5],
350
  [encode_img_output1, encode_img_output2, encode_img_output3, select_img_input_w2,
351
  select_img_input_img2])
352
- encode_img_examples.click(lambda x: x[0], [encode_img_examples], [encode_img_input])
353
  select_img1_button.click(lambda i, img1, img2, w1, w2: (img1, w1) if i == 0 else (img2, w2),
354
  [select_img1_dropdown, select_img_input_img1, select_img_input_img2,
355
  select_img_input_w1, select_img_input_w2],
 
282
  app = gr.Blocks()
283
  with app:
284
  gr.Markdown("# full-body anime GAN\n\n"
285
+ "![visitor badge](https://api.visitorbadge.io/api/visitors?path=skytnt.full-body-anime-gan&countColor=%23263759&style=flat&labelStyle=lower)\n\n")
286
  with gr.Tabs():
287
  with gr.TabItem("generate image"):
288
  with gr.Row():
 
298
  gen_submit = gr.Button("Generate", variant="primary")
299
  with gr.Column():
300
  gen_output1 = gr.Image(label="output image")
301
+ select_img_input_w1 = gr.State()
302
+ select_img_input_img1 = gr.State()
303
 
304
  with gr.TabItem("encode image"):
305
  with gr.Row():
 
307
  gr.Markdown("you'd better upload a standing full-body image")
308
  encode_img_input = gr.Image(label="input image")
309
  examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 5)]
310
+ encode_img_examples = gr.Examples(examples=examples_data,inputs=[encode_img_input],cache_examples=False)
311
  with gr.Group():
312
  encode_img_submit = gr.Button("Run", variant="primary")
313
  with gr.Column():
 
315
  with gr.Row():
316
  encode_img_output2 = gr.Image(label="detected")
317
  encode_img_output3 = gr.Image(label="encoded")
318
+ select_img_input_w2 = gr.State()
319
+ select_img_input_img2 = gr.State()
320
 
321
  with gr.TabItem("generate video"):
322
  with gr.Row():
 
330
  with gr.Group():
331
  select_img1_button = gr.Button("Select", variant="primary")
332
  select_img1_output_img = gr.Image(label="selected image 1")
333
+ select_img1_output_w = gr.State()
334
  with gr.Column():
335
  select_img2_dropdown = gr.Radio(label="Select image 2", value="current generated image",
336
  choices=["current generated image",
 
338
  with gr.Group():
339
  select_img2_button = gr.Button("Select", variant="primary")
340
  select_img2_output_img = gr.Image(label="selected image 2")
341
+ select_img2_output_w = gr.State()
342
  generate_video_frame = gr.Slider(minimum=10, maximum=30, step=1, label="frame", value=15)
343
  with gr.Group():
344
  generate_video_button = gr.Button("Generate", variant="primary")
 
349
  encode_img_submit.click(encode_img_fn, [encode_img_input, gen_input5],
350
  [encode_img_output1, encode_img_output2, encode_img_output3, select_img_input_w2,
351
  select_img_input_img2])
 
352
  select_img1_button.click(lambda i, img1, img2, w1, w2: (img1, w1) if i == 0 else (img2, w2),
353
  [select_img1_dropdown, select_img_input_img1, select_img_input_img2,
354
  select_img_input_w1, select_img_input_w2],