juyam commited on
Commit
156bd6b
·
1 Parent(s): 60edeaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -4,7 +4,7 @@ def resize_image(img):
4
  new_w=720
5
  new_h=img.height*new_w//img.width
6
  resized_image = img.resize((new_w, new_h))
7
- return [resized_image,'width="360" />']
8
 
9
  with gr.Blocks() as iface:
10
 
@@ -13,17 +13,20 @@ with gr.Blocks() as iface:
13
  1. 変更元画像を選択
14
  1. 生成 ボタン押す
15
  1. 変更後画像を保存
16
- 1. htmlソースの文末コピー用タグ置き換え'''
17
 
18
  gr.Markdown(my_md)
19
 
20
  txt_3 = gr.Textbox(value='width="360" />', label="コピー用htmlタグ")
21
 
 
22
  with gr.Row():
23
  im = gr.Image(type="pil", label="変更元画像")
24
  im_2 = gr.Image(type="pil", label="変更後画像 幅720px")
25
 
26
- btn = gr.Button(value="生成")
27
- btn.click(resize_image, inputs=[im], outputs=[im_2,txt_3])
 
 
28
 
29
  iface.launch()
 
4
  new_w=720
5
  new_h=img.height*new_w//img.width
6
  resized_image = img.resize((new_w, new_h))
7
+ return resized_image
8
 
9
  with gr.Blocks() as iface:
10
 
 
13
  1. 変更元画像を選択
14
  1. 生成 ボタン押す
15
  1. 変更後画像を保存
16
+ 1. htmlソースの文末の /> をコピー用タグ置き換え'''
17
 
18
  gr.Markdown(my_md)
19
 
20
  txt_3 = gr.Textbox(value='width="360" />', label="コピー用htmlタグ")
21
 
22
+
23
  with gr.Row():
24
  im = gr.Image(type="pil", label="変更元画像")
25
  im_2 = gr.Image(type="pil", label="変更後画像 幅720px")
26
 
27
+ with gr.Row():
28
+ btn = gr.Button(value="生成")
29
+ btn.click(resize_image, inputs=[im], outputs=[im_2])
30
+ clearbutton = gr.ClearButton([im,im_2])
31
 
32
  iface.launch()