radames commited on
Commit
b4d6267
1 Parent(s): 0975c13

Enabled API and update Gradio

Browse files

* Enable API for main inference points, `generate_img2obj` and `generate_txt2obj`.
* Upgrade Gradio to lastest version. Now Model 3d has a download file icon.
* Cache Examples: this will make your build time increase, but examples faster

Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +4 -4
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🐢
4
  colorFrom: yellow
5
  colorTo: blue
6
  sdk: gradio
7
- sdk_version: 3.16.1b1
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: yellow
5
  colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 3.17.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -233,9 +233,9 @@ with gr.Blocks() as app:
233
  outputs = [plot, model_3d, file_out]
234
 
235
  prompt.submit(generate_3D, inputs=[prompt, dropdown_models, guidance_scale, grid_size], outputs=outputs)
236
- btn_generate_txt2obj.click(generate_3D, inputs=[prompt, dropdown_models, guidance_scale, grid_size], outputs=outputs)
237
 
238
- btn_generate_img2obj.click(generate_3D, inputs=[img, dropdown_models, guidance_scale, grid_size], outputs=outputs)
239
 
240
  prompt_sd.submit(generate_txt2img, inputs=prompt_sd, outputs=[img_sd, btn_generate_sd2obj])
241
  btn_generate_txt2sd.click(generate_txt2img, inputs=prompt_sd, outputs=[img_sd, btn_generate_sd2obj], queue=False)
@@ -255,7 +255,7 @@ with gr.Blocks() as app:
255
  inputs=[prompt],
256
  outputs=outputs,
257
  fn=generate_3D,
258
- cache_examples=False
259
  )
260
 
261
  gr.Examples(
@@ -267,7 +267,7 @@ with gr.Blocks() as app:
267
  inputs=[img],
268
  outputs=outputs,
269
  fn=generate_3D,
270
- cache_examples=False
271
  )
272
 
273
  # app.load(get_state, inputs=[], outputs=state_info, every=0.5, show_progress=False)
 
233
  outputs = [plot, model_3d, file_out]
234
 
235
  prompt.submit(generate_3D, inputs=[prompt, dropdown_models, guidance_scale, grid_size], outputs=outputs)
236
+ btn_generate_txt2obj.click(generate_3D, inputs=[prompt, dropdown_models, guidance_scale, grid_size], outputs=outputs, api_name="generate_txt2obj")
237
 
238
+ btn_generate_img2obj.click(generate_3D, inputs=[img, dropdown_models, guidance_scale, grid_size], outputs=outputs, api_name="generate_img2obj")
239
 
240
  prompt_sd.submit(generate_txt2img, inputs=prompt_sd, outputs=[img_sd, btn_generate_sd2obj])
241
  btn_generate_txt2sd.click(generate_txt2img, inputs=prompt_sd, outputs=[img_sd, btn_generate_sd2obj], queue=False)
 
255
  inputs=[prompt],
256
  outputs=outputs,
257
  fn=generate_3D,
258
+ cache_examples=True
259
  )
260
 
261
  gr.Examples(
 
267
  inputs=[img],
268
  outputs=outputs,
269
  fn=generate_3D,
270
+ cache_examples=True
271
  )
272
 
273
  # app.load(get_state, inputs=[], outputs=state_info, every=0.5, show_progress=False)