MaxMilan1 commited on
Commit
c99851d
1 Parent(s): e90f748

gen_image_var??

Browse files
Files changed (2) hide show
  1. app.py +11 -4
  2. util/text_img.py +5 -1
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import os
3
 
4
  from util.instantmesh import generate_mvs, make3d, preprocess, check_input_image
5
- from util.text_img import generate_txttoimg, check_prompt, generate_imgtoimg
6
 
7
  _CITE_ = r"""
8
  ```bibtex
@@ -24,6 +24,7 @@ theme = gr.themes.Soft(
24
 
25
 
26
  with gr.Blocks(theme=theme) as GenDemo:
 
27
  with gr.Tab("Image to Image Generator"):
28
  with gr.Row(variant="panel"):
29
  with gr.Column():
@@ -42,7 +43,7 @@ with gr.Blocks(theme=theme) as GenDemo:
42
  button_img = gr.Button("Generate Image", elem_id="generateIm", variant="primary")
43
  gen_image = gr.Image(label="Generated Image", image_mode="RGBA", type='pil', show_download_button=True, show_label=False)
44
 
45
- button_img.click(check_prompt, inputs=[prompt]).success(generate_imgtoimg, inputs=[prompt, image, strength], outputs=[gen_image])
46
 
47
  with gr.Tab("Text to Image Generator"):
48
  with gr.Row(variant="panel"):
@@ -62,12 +63,18 @@ with gr.Blocks(theme=theme) as GenDemo:
62
  button_txt = gr.Button("Generate Image", elem_id="generateIm", variant="primary")
63
  gen_image = gr.Image(label="Generated Image", image_mode="RGBA", type='pil', show_download_button=True, show_label=False)
64
 
65
- button_txt.click(check_prompt, inputs=[prompt]).success(generate_txttoimg, inputs=[prompt, controlNet_image, select], outputs=[gen_image])
66
 
67
  with gr.Tab("Image to 3D Model Generator"):
68
  with gr.Row(variant="panel"):
69
  with gr.Column():
70
  with gr.Row():
 
 
 
 
 
 
71
  processed_image = gr.Image(
72
  label="Processed Image",
73
  image_mode="RGBA",
@@ -125,7 +132,7 @@ with gr.Blocks(theme=theme) as GenDemo:
125
 
126
  mv_images = gr.State()
127
 
128
- submit.click(fn=check_input_image, inputs=[gen_image]).success(
129
  fn=preprocess,
130
  inputs=[gen_image, do_remove_background],
131
  outputs=[processed_image],
 
2
  import os
3
 
4
  from util.instantmesh import generate_mvs, make3d, preprocess, check_input_image
5
+ from util.text_img import generate_txttoimg, check_prompt, generate_imgtoimg, update_image
6
 
7
  _CITE_ = r"""
8
  ```bibtex
 
24
 
25
 
26
  with gr.Blocks(theme=theme) as GenDemo:
27
+ gen_image_var = gr.State()
28
  with gr.Tab("Image to Image Generator"):
29
  with gr.Row(variant="panel"):
30
  with gr.Column():
 
43
  button_img = gr.Button("Generate Image", elem_id="generateIm", variant="primary")
44
  gen_image = gr.Image(label="Generated Image", image_mode="RGBA", type='pil', show_download_button=True, show_label=False)
45
 
46
+ button_img.click(check_prompt, inputs=[prompt]).success(generate_imgtoimg, inputs=[prompt, image, strength], outputs=[gen_image_var]).success(update_image, inputs=[gen_image_var], outputs=[gen_image])
47
 
48
  with gr.Tab("Text to Image Generator"):
49
  with gr.Row(variant="panel"):
 
63
  button_txt = gr.Button("Generate Image", elem_id="generateIm", variant="primary")
64
  gen_image = gr.Image(label="Generated Image", image_mode="RGBA", type='pil', show_download_button=True, show_label=False)
65
 
66
+ button_txt.click(check_prompt, inputs=[prompt]).success(generate_txttoimg, inputs=[prompt, controlNet_image, select], outputs=[gen_image_var]).success(update_image, inputs=[gen_image_var], outputs=[gen_image])
67
 
68
  with gr.Tab("Image to 3D Model Generator"):
69
  with gr.Row(variant="panel"):
70
  with gr.Column():
71
  with gr.Row():
72
+ input_image = gr.Image(
73
+ label="Input Image",
74
+ image_mode="RGBA",
75
+ type="pil",
76
+ interactive=True
77
+ )
78
  processed_image = gr.Image(
79
  label="Processed Image",
80
  image_mode="RGBA",
 
132
 
133
  mv_images = gr.State()
134
 
135
+ submit.click(fn=check_input_image, inputs=[gen_image_var]).success(
136
  fn=preprocess,
137
  inputs=[gen_image, do_remove_background],
138
  outputs=[processed_image],
util/text_img.py CHANGED
@@ -119,4 +119,8 @@ def get_depth(image):
119
  # image = image[:,:,None]
120
  # image = np.concatenate([image, image, image], axis=2)
121
  # canny_image = Image.fromarray(image)
122
- # return canny_image
 
 
 
 
 
119
  # image = image[:,:,None]
120
  # image = np.concatenate([image, image, image], axis=2)
121
  # canny_image = Image.fromarray(image)
122
+ # return canny_image
123
+
124
+ def update_image(image):
125
+ return image
126
+