evalstate HF Staff commited on
Commit
42a146e
·
verified ·
1 Parent(s): ff3266f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -205,8 +205,9 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
205
  output_gallery = gr.Gallery(label="Generated Images", columns=2, visible=True) # Default to visible, content will control
206
  output_text = gr.Textbox(label="Generated Text", visible=False, lines=5, interactive=False)
207
 
208
- @spaces.GPU
209
  def run_img_txt_to_img_tab(prompt, img, steps, seed, txt_cfg, img_cfg, progress=gr.Progress(track_tqdm=True)):
 
210
  if img is None:
211
  return (
212
  gr.update(value=[], visible=False),
@@ -219,7 +220,8 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
219
  gr.update(value="", visible=False)
220
  )
221
 
222
- @spaces.GPU
 
223
  def run_txt_to_img_tab(prompt, height, width, steps, seed, guidance, progress=gr.Progress(track_tqdm=True)):
224
  # Seed is already finalized by the randomize_seed_fn in the click chain
225
  imgs = process_txt_to_img(prompt, height, width, steps, seed, guidance, progress=progress)
@@ -228,7 +230,8 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
228
  gr.update(value="", visible=False)
229
  )
230
 
231
- @spaces.GPU
 
232
  def run_img_to_txt_tab(img, prompt, progress=gr.Progress(track_tqdm=True)):
233
  if img is None:
234
  return (
@@ -341,4 +344,4 @@ with gr.Blocks(title="Ovis-U1-3B") as demo:
341
  )
342
 
343
  if __name__ == "__main__":
344
- demo.launch(share=True)
 
205
  output_gallery = gr.Gallery(label="Generated Images", columns=2, visible=True) # Default to visible, content will control
206
  output_text = gr.Textbox(label="Generated Text", visible=False, lines=5, interactive=False)
207
 
208
+ @spaces.GPU(duration=20)
209
  def run_img_txt_to_img_tab(prompt, img, steps, seed, txt_cfg, img_cfg, progress=gr.Progress(track_tqdm=True)):
210
+ """Use Ovis-U1-3B to modify an image. Supply Image and Text Prompt"""
211
  if img is None:
212
  return (
213
  gr.update(value=[], visible=False),
 
220
  gr.update(value="", visible=False)
221
  )
222
 
223
+ @spaces.GPU(duration=20)
224
+ """Use Ovis-U1-3B to generate an Image."""
225
  def run_txt_to_img_tab(prompt, height, width, steps, seed, guidance, progress=gr.Progress(track_tqdm=True)):
226
  # Seed is already finalized by the randomize_seed_fn in the click chain
227
  imgs = process_txt_to_img(prompt, height, width, steps, seed, guidance, progress=progress)
 
230
  gr.update(value="", visible=False)
231
  )
232
 
233
+ @spaces.GPU(duration=20)
234
+ """User Ovis-U1-3B to understand an Image (Vision processing)"""
235
  def run_img_to_txt_tab(img, prompt, progress=gr.Progress(track_tqdm=True)):
236
  if img is None:
237
  return (
 
344
  )
345
 
346
  if __name__ == "__main__":
347
+ demo.launch(mcp_server=True)