Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -234,7 +234,7 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
|
|
| 234 |
|
| 235 |
@spaces.GPU(duration=20)
|
| 236 |
def run_img_to_txt_tab(img, prompt, progress=gr.Progress(track_tqdm=True),show_api=False):
|
| 237 |
-
"""
|
| 238 |
if img is None:
|
| 239 |
return (
|
| 240 |
gr.update(value=[], visible=False),
|
|
@@ -296,54 +296,54 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
|
|
| 296 |
)
|
| 297 |
|
| 298 |
# Event listeners for Text -> Image
|
| 299 |
-
gen_inputs = [prompt_gen_input, height_slider, width_slider, num_steps_slider, seed_slider, guidance_slider]
|
| 300 |
|
| 301 |
-
run_image_gen_btn.click(
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
).then(
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
)
|
| 310 |
-
|
| 311 |
-
prompt_gen_input.submit(
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
).then(
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
)
|
| 320 |
|
| 321 |
# Event listeners for Image -> Text
|
| 322 |
-
understand_inputs = [image_understand_input, prompt_understand_input]
|
| 323 |
-
|
| 324 |
-
run_image_understand_btn.click(
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
)
|
| 329 |
-
|
| 330 |
-
prompt_understand_input.submit(
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
)
|
| 335 |
-
|
| 336 |
-
clean_btn.click(
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
)
|
| 347 |
|
| 348 |
if __name__ == "__main__":
|
| 349 |
demo.launch(mcp_server=True)
|
|
|
|
| 234 |
|
| 235 |
@spaces.GPU(duration=20)
|
| 236 |
def run_img_to_txt_tab(img, prompt, progress=gr.Progress(track_tqdm=True),show_api=False):
|
| 237 |
+
"""Use Ovis-U1-3B to understand an Image (Vision processing)"""
|
| 238 |
if img is None:
|
| 239 |
return (
|
| 240 |
gr.update(value=[], visible=False),
|
|
|
|
| 296 |
)
|
| 297 |
|
| 298 |
# Event listeners for Text -> Image
|
| 299 |
+
# gen_inputs = [prompt_gen_input, height_slider, width_slider, num_steps_slider, seed_slider, guidance_slider]
|
| 300 |
|
| 301 |
+
# run_image_gen_btn.click(
|
| 302 |
+
# fn=randomize_seed_fn,
|
| 303 |
+
# inputs=[seed_slider, randomize_checkbox],
|
| 304 |
+
# outputs=[seed_slider]
|
| 305 |
+
# ).then(
|
| 306 |
+
# fn=run_txt_to_img_tab,
|
| 307 |
+
# inputs=gen_inputs,
|
| 308 |
+
# outputs=[output_gallery, output_text]
|
| 309 |
+
# )
|
| 310 |
+
|
| 311 |
+
# prompt_gen_input.submit(
|
| 312 |
+
# fn=randomize_seed_fn,
|
| 313 |
+
# inputs=[seed_slider, randomize_checkbox],
|
| 314 |
+
# outputs=[seed_slider]
|
| 315 |
+
# ).then(
|
| 316 |
+
# fn=run_txt_to_img_tab,
|
| 317 |
+
# inputs=gen_inputs,
|
| 318 |
+
# outputs=[output_gallery, output_text]
|
| 319 |
+
# )
|
| 320 |
|
| 321 |
# Event listeners for Image -> Text
|
| 322 |
+
# understand_inputs = [image_understand_input, prompt_understand_input]
|
| 323 |
+
|
| 324 |
+
# run_image_understand_btn.click(
|
| 325 |
+
# fn=run_img_to_txt_tab,
|
| 326 |
+
# inputs=understand_inputs,
|
| 327 |
+
# outputs=[output_gallery, output_text]
|
| 328 |
+
# )
|
| 329 |
+
|
| 330 |
+
# prompt_understand_input.submit(
|
| 331 |
+
# fn=run_img_to_txt_tab,
|
| 332 |
+
# inputs=understand_inputs,
|
| 333 |
+
# outputs=[output_gallery, output_text]
|
| 334 |
+
# )
|
| 335 |
+
|
| 336 |
+
# clean_btn.click(
|
| 337 |
+
# fn=clean_all_fn,
|
| 338 |
+
# inputs=[],
|
| 339 |
+
# outputs=[
|
| 340 |
+
# edit_image_input, edit_prompt_input, edit_img_guidance_slider, edit_txt_guidance_slider,
|
| 341 |
+
# edit_num_steps_slider, edit_seed_slider, edit_randomize_checkbox,
|
| 342 |
+
# prompt_gen_input, height_slider, width_slider, guidance_slider, num_steps_slider, seed_slider, randomize_checkbox,
|
| 343 |
+
# image_understand_input, prompt_understand_input,
|
| 344 |
+
# output_gallery, output_text
|
| 345 |
+
# ]
|
| 346 |
+
# )
|
| 347 |
|
| 348 |
if __name__ == "__main__":
|
| 349 |
demo.launch(mcp_server=True)
|