vibs08 commited on
Commit
6d7239f
·
verified ·
1 Parent(s): 734a7c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -89,22 +89,18 @@ def run_example(text_prompt, do_remove_background, foreground_ratio, mc_resoluti
89
 
90
  return preprocessed, mesh_name_obj, mesh_name_glb
91
 
 
92
  with gr.Blocks() as demo:
93
  gr.Markdown(HEADER)
94
  with gr.Row(variant="panel"):
95
  with gr.Column():
96
  with gr.Row():
97
- # text_prompt = gr.Textbox(
98
- # label="Text Prompt",
99
- # placeholder="Enter a text prompt for image generation"
100
- # )
101
  input_image = gr.Image(
102
- label="Generated Image",
103
  image_mode="RGBA",
104
  sources="upload",
105
  type="pil",
106
  elem_id="content_image",
107
- visible=False # Hidden since we generate the image from text
108
  )
109
  processed_image = gr.Image(label="Processed Image", interactive=False)
110
  with gr.Row():
@@ -149,15 +145,19 @@ with gr.Blocks() as demo:
149
  inputs=[input_image],
150
  outputs=[processed_image, output_model_obj, output_model_glb],
151
  cache_examples=True,
152
- fn=partial(run_example, do_remove_background=True, foreground_ratio=0.85, mc_resolution=256),
153
  label="Examples",
154
  examples_per_page=20
155
  )
156
- submit.click(fn=check_input_image, inputs=[text_prompt]).success(
157
- fn=run_example,
158
- inputs=[input_image, do_remove_background, foreground_ratio, mc_resolution],
159
- outputs=[processed_image, output_model_obj, output_model_glb],
 
 
 
 
160
  )
161
 
162
  demo.queue(max_size=10)
163
- demo.launch()
 
89
 
90
  return preprocessed, mesh_name_obj, mesh_name_glb
91
 
92
+
93
  with gr.Blocks() as demo:
94
  gr.Markdown(HEADER)
95
  with gr.Row(variant="panel"):
96
  with gr.Column():
97
  with gr.Row():
 
 
 
 
98
  input_image = gr.Image(
99
+ label="Input Image",
100
  image_mode="RGBA",
101
  sources="upload",
102
  type="pil",
103
  elem_id="content_image",
 
104
  )
105
  processed_image = gr.Image(label="Processed Image", interactive=False)
106
  with gr.Row():
 
145
  inputs=[input_image],
146
  outputs=[processed_image, output_model_obj, output_model_glb],
147
  cache_examples=True,
148
+ fn=partial(run_example),
149
  label="Examples",
150
  examples_per_page=20
151
  )
152
+ submit.click(fn=check_input_image, inputs=[input_image]).success(
153
+ fn=preprocess,
154
+ inputs=[input_image, do_remove_background, foreground_ratio],
155
+ outputs=[processed_image],
156
+ ).success(
157
+ fn=generate,
158
+ inputs=[processed_image, mc_resolution],
159
+ outputs=[output_model_obj, output_model_glb],
160
  )
161
 
162
  demo.queue(max_size=10)
163
+ demo.launch()