gensym commited on
Commit
6e47b5e
·
1 Parent(s): 8e0b0a8
Files changed (1) hide show
  1. app.py +63 -54
app.py CHANGED
@@ -153,6 +153,9 @@ def deactivate_button() -> gr.Button:
153
  return gr.Button(interactive=False)
154
 
155
 
 
 
 
156
  with gr.Blocks() as demo:
157
  gr.Markdown("""
158
  ## Image to 3D Asset with [TRELLIS](https://trellis3d.github.io/)
@@ -160,6 +163,12 @@ with gr.Blocks() as demo:
160
  * If you find the generated 3D asset satisfactory, click "Extract GLB" to extract the GLB file and download it.
161
  """)
162
 
 
 
 
 
 
 
163
  # with gr.Row():
164
  # with gr.Column():
165
  # image_prompt = gr.Image(label="Image Prompt", image_mode="RGBA", type="pil", height=300)
@@ -189,61 +198,61 @@ with gr.Blocks() as demo:
189
  # model_output = LitModel3D(label="Extracted GLB", exposure=20.0, height=300)
190
  # download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
191
 
192
- trial_id = gr.Textbox(visible=False)
193
- output_buf = gr.State()
194
-
195
- # Example images at the bottom of the page
196
- with gr.Row():
197
- examples = gr.Examples(
198
- examples=[
199
- f'assets/example_image/{image}'
200
- for image in os.listdir("assets/example_image")
201
- ],
202
- inputs=[image_prompt],
203
- fn=preprocess_image,
204
- outputs=[trial_id, image_prompt],
205
- run_on_click=True,
206
- examples_per_page=64,
207
- )
208
-
209
- # Handlers
210
- image_prompt.upload(
211
- preprocess_image,
212
- inputs=[image_prompt],
213
- outputs=[trial_id, image_prompt],
214
- )
215
- image_prompt.clear(
216
- lambda: '',
217
- outputs=[trial_id],
218
- )
219
 
220
- generate_btn.click(
221
- image_to_3d,
222
- inputs=[trial_id, seed, randomize_seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
223
- outputs=[output_buf, video_output],
224
- ).then(
225
- activate_button,
226
- outputs=[extract_glb_btn],
227
- )
228
-
229
- video_output.clear(
230
- deactivate_button,
231
- outputs=[extract_glb_btn],
232
- )
233
-
234
- extract_glb_btn.click(
235
- extract_glb,
236
- inputs=[output_buf, mesh_simplify, texture_size],
237
- outputs=[model_output, download_glb],
238
- ).then(
239
- activate_button,
240
- outputs=[download_glb],
241
- )
242
-
243
- model_output.clear(
244
- deactivate_button,
245
- outputs=[download_glb],
246
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
 
249
  # Cleans up the temporary directory every 10 minutes
 
153
  return gr.Button(interactive=False)
154
 
155
 
156
+ def update(name):
157
+ return f"Welcome to Gradio, {name}!"
158
+
159
  with gr.Blocks() as demo:
160
  gr.Markdown("""
161
  ## Image to 3D Asset with [TRELLIS](https://trellis3d.github.io/)
 
163
  * If you find the generated 3D asset satisfactory, click "Extract GLB" to extract the GLB file and download it.
164
  """)
165
 
166
+ with gr.Row():
167
+ inp = gr.Textbox(placeholder="What is your name?")
168
+ out = gr.Textbox()
169
+ btn = gr.Button("Run")
170
+ btn.click(fn=update, inputs=inp, outputs=out)
171
+
172
  # with gr.Row():
173
  # with gr.Column():
174
  # image_prompt = gr.Image(label="Image Prompt", image_mode="RGBA", type="pil", height=300)
 
198
  # model_output = LitModel3D(label="Extracted GLB", exposure=20.0, height=300)
199
  # download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
200
 
201
+ # trial_id = gr.Textbox(visible=False)
202
+ # output_buf = gr.State()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
+ # # Example images at the bottom of the page
205
+ # with gr.Row():
206
+ # examples = gr.Examples(
207
+ # examples=[
208
+ # f'assets/example_image/{image}'
209
+ # for image in os.listdir("assets/example_image")
210
+ # ],
211
+ # inputs=[image_prompt],
212
+ # fn=preprocess_image,
213
+ # outputs=[trial_id, image_prompt],
214
+ # run_on_click=True,
215
+ # examples_per_page=64,
216
+ # )
217
+
218
+ # # Handlers
219
+ # image_prompt.upload(
220
+ # preprocess_image,
221
+ # inputs=[image_prompt],
222
+ # outputs=[trial_id, image_prompt],
223
+ # )
224
+ # image_prompt.clear(
225
+ # lambda: '',
226
+ # outputs=[trial_id],
227
+ # )
228
+
229
+ # generate_btn.click(
230
+ # image_to_3d,
231
+ # inputs=[trial_id, seed, randomize_seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
232
+ # outputs=[output_buf, video_output],
233
+ # ).then(
234
+ # activate_button,
235
+ # outputs=[extract_glb_btn],
236
+ # )
237
+
238
+ # video_output.clear(
239
+ # deactivate_button,
240
+ # outputs=[extract_glb_btn],
241
+ # )
242
+
243
+ # extract_glb_btn.click(
244
+ # extract_glb,
245
+ # inputs=[output_buf, mesh_simplify, texture_size],
246
+ # outputs=[model_output, download_glb],
247
+ # ).then(
248
+ # activate_button,
249
+ # outputs=[download_glb],
250
+ # )
251
+
252
+ # model_output.clear(
253
+ # deactivate_button,
254
+ # outputs=[download_glb],
255
+ # )
256
 
257
 
258
  # Cleans up the temporary directory every 10 minutes