0x90e commited on
Commit
cb044a4
·
1 Parent(s): 9e14730

Test better interface

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -38,9 +38,9 @@ def inference(img, size, type):
38
  run_cmd(f"rm -f {img_in_path}")
39
  run_cmd(f"rm -f {img_out_path}")
40
 
41
- return [img_out]
 
42
 
43
- input_image = gr.Image(type="pil", label="Input")
44
  upscale_type = gr.Radio(["Manga", "Anime", "General"], label="Select the type of picture you want to upscale:", value="Manga")
45
  upscale_size = gr.Radio(["x4", "x2"], label="Upscale by:", value="x4")
46
  output_image = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
@@ -49,14 +49,24 @@ title = "ESRGAN Upscaling With Custom Models"
49
  description = "This space uses old ESRGAN architecture to upscale images, using models made by the community."
50
  article = "<p><a href='https://upscale.wiki/wiki/Model_Database'>Model Database</a></p>"
51
 
52
- demo = gr.Interface(
 
 
 
 
 
 
 
 
 
 
53
  inference,
54
  inputs=[input_image, upscale_size, upscale_type],
55
  outputs=[output_image],
56
  title=title,
57
  description=description,
58
  article=article
59
- )
60
 
61
  demo.queue()
62
  demo.launch(debug=is_colab, share=is_colab, inline=is_colab)
 
38
  run_cmd(f"rm -f {img_in_path}")
39
  run_cmd(f"rm -f {img_out_path}")
40
 
41
+ return img_out
42
+
43
 
 
44
  upscale_type = gr.Radio(["Manga", "Anime", "General"], label="Select the type of picture you want to upscale:", value="Manga")
45
  upscale_size = gr.Radio(["x4", "x2"], label="Upscale by:", value="x4")
46
  output_image = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
 
49
  description = "This space uses old ESRGAN architecture to upscale images, using models made by the community."
50
  article = "<p><a href='https://upscale.wiki/wiki/Model_Database'>Model Database</a></p>"
51
 
52
+ with gr.Blocks() as demo:
53
+ with gr.Row():
54
+ with gr.Column():
55
+ input_image = gr.Image(type="pil", label="Input")
56
+ translate_btn = gr.Button(value="Upscale", variant="primary")
57
+ with gr.Column():
58
+ output_image = gr.Image(type="file")
59
+ save_btn = gr.Button(value="Save image")
60
+
61
+
62
+ """ demo = gr.Interface(
63
  inference,
64
  inputs=[input_image, upscale_size, upscale_type],
65
  outputs=[output_image],
66
  title=title,
67
  description=description,
68
  article=article
69
+ ) """
70
 
71
  demo.queue()
72
  demo.launch(debug=is_colab, share=is_colab, inline=is_colab)