arj7192 commited on
Commit
da9757a
·
verified ·
1 Parent(s): bc33f7e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -474,7 +474,7 @@ def position_text_back(text, merged_coordinates, inpainted_image, font_path, fon
474
  def process(image, mask,
475
  prompt="background",
476
  negative_prompt="text",
477
- num_inference_steps=10,
478
  controlnet_conditioning_scale=0.9,
479
  guidance_scale=3.5,
480
  seed=124,
@@ -505,7 +505,7 @@ def process(image, mask,
505
 
506
 
507
  @spaces.GPU()
508
- def process_image(image, source_language, target_language, mode, font, font_color, num_inference_steps):
509
  """Main processing function for Gradio"""
510
  if image is None:
511
  return None, None, None, []
@@ -595,7 +595,6 @@ with gr.Blocks(title="Nativ - Demo") as demo:
595
  value='omniscript_bold',
596
  label="Select Font"
597
  )
598
- num_inference_steps = gr.Slider(minimum=1, step=1, maximum=50, value=10, label="num_inference_steps")
599
  font_color_picker_i = gr.ColorPicker(
600
  value="#000000", # Default color: black
601
  label="Select Font Color"
@@ -627,8 +626,8 @@ with gr.Blocks(title="Nativ - Demo") as demo:
627
  )
628
  update_btn = gr.Button("Apply Changes")
629
 
630
- def process_and_show_translations(image, source_lang, target_lang, mode, font, font_color, num_inference_steps):
631
- boxes, bubbles, removed, final, translations, mask = process_image(image, source_lang, target_lang, mode, font, font_color, num_inference_steps)
632
  # Extract just the texts and join with newlines
633
  texts = '\n'.join(t['text'] for t in translations)
634
  return boxes, bubbles, removed, final, texts, translations
@@ -636,7 +635,7 @@ with gr.Blocks(title="Nativ - Demo") as demo:
636
  # Process button click
637
  process_btn.click(
638
  fn=process_and_show_translations,
639
- inputs=[input_image, source_language, target_language, localization_mode, font_selector_i, font_color_picker_i, num_inference_steps],
640
  outputs=[detected_boxes, speech_bubbles, removed_text, final_output, translations_text, translations_state]
641
  )
642
 
 
474
  def process(image, mask,
475
  prompt="background",
476
  negative_prompt="text",
477
+ num_inference_steps=15,
478
  controlnet_conditioning_scale=0.9,
479
  guidance_scale=3.5,
480
  seed=124,
 
505
 
506
 
507
  @spaces.GPU()
508
+ def process_image(image, source_language, target_language, mode, font, font_color, num_inference_steps=15):
509
  """Main processing function for Gradio"""
510
  if image is None:
511
  return None, None, None, []
 
595
  value='omniscript_bold',
596
  label="Select Font"
597
  )
 
598
  font_color_picker_i = gr.ColorPicker(
599
  value="#000000", # Default color: black
600
  label="Select Font Color"
 
626
  )
627
  update_btn = gr.Button("Apply Changes")
628
 
629
+ def process_and_show_translations(image, source_lang, target_lang, mode, font, font_color):
630
+ boxes, bubbles, removed, final, translations, mask = process_image(image, source_lang, target_lang, mode, font, font_color)
631
  # Extract just the texts and join with newlines
632
  texts = '\n'.join(t['text'] for t in translations)
633
  return boxes, bubbles, removed, final, texts, translations
 
635
  # Process button click
636
  process_btn.click(
637
  fn=process_and_show_translations,
638
+ inputs=[input_image, source_language, target_language, localization_mode, font_selector_i, font_color_picker_i],
639
  outputs=[detected_boxes, speech_bubbles, removed_text, final_output, translations_text, translations_state]
640
  )
641