Upload app.py
Browse files
app.py
CHANGED
@@ -517,7 +517,7 @@ def process_image(image, source_language, target_language, mode, font, font_colo
|
|
517 |
# Detect text and get results
|
518 |
img_with_boxes, img_bubbles, img_removed_text, merged_results, mask = detect_and_show_text(reader, image)
|
519 |
|
520 |
-
if mode == "Basic":
|
521 |
img_inpainted = img_removed_text
|
522 |
else:
|
523 |
img_inpainted = process(image, mask, num_inference_steps=num_inference_steps)
|
@@ -563,11 +563,11 @@ def update_translations(image, edited_texts, translations_list, img_removed_text
|
|
563 |
return np.array(final_result)
|
564 |
|
565 |
|
566 |
-
with gr.Blocks(title="Nativ -
|
567 |
# Store translations list in state
|
568 |
translations_state = gr.State([])
|
569 |
|
570 |
-
gr.Markdown("# Nativ -
|
571 |
|
572 |
with gr.Row():
|
573 |
with gr.Column():
|
@@ -585,8 +585,8 @@ with gr.Blocks(title="Nativ - Demo") as demo:
|
|
585 |
)
|
586 |
# Toggle for mode selection
|
587 |
localization_mode = gr.Radio(
|
588 |
-
choices=["Basic", "Advanced"],
|
589 |
-
value="Basic",
|
590 |
label="Localization Mode"
|
591 |
)
|
592 |
font_selector_i = gr.Dropdown(
|
@@ -654,10 +654,10 @@ with gr.Blocks(title="Nativ - Demo") as demo:
|
|
654 |
# Add examples here
|
655 |
gr.Examples(
|
656 |
examples=[
|
657 |
-
["assets/chinese.png", "Simplified Chinese", "English", "Basic", "omniscript_bold", "#000000"],
|
658 |
-
["assets/chinese.png", "Simplified Chinese", "English", "Advanced", "Ldfcomicsansbold", "#d31515"],
|
659 |
-
["assets/korean.png", "Korean", "Spanish", "Basic", "omniscript_bold", "#000000"],
|
660 |
-
["assets/chinese.png", "English", "French", "Basic", "omniscript_bold", "#000000"],
|
661 |
],
|
662 |
inputs=[input_image, source_language, target_language, localization_mode, font_selector_i, font_color_picker_i]
|
663 |
)
|
|
|
517 |
# Detect text and get results
|
518 |
img_with_boxes, img_bubbles, img_removed_text, merged_results, mask = detect_and_show_text(reader, image)
|
519 |
|
520 |
+
if mode == "Basic (speech bubbles only)":
|
521 |
img_inpainted = img_removed_text
|
522 |
else:
|
523 |
img_inpainted = process(image, mask, num_inference_steps=num_inference_steps)
|
|
|
563 |
return np.array(final_result)
|
564 |
|
565 |
|
566 |
+
with gr.Blocks(title="Nativ Demo - Localize text within Comics") as demo:
|
567 |
# Store translations list in state
|
568 |
translations_state = gr.State([])
|
569 |
|
570 |
+
gr.Markdown("# Nativ Demo - Localize text within Comics")
|
571 |
|
572 |
with gr.Row():
|
573 |
with gr.Column():
|
|
|
585 |
)
|
586 |
# Toggle for mode selection
|
587 |
localization_mode = gr.Radio(
|
588 |
+
choices=["Basic (speech bubbles only)", "Advanced (all text)"],
|
589 |
+
value="Basic (speech bubbles only)",
|
590 |
label="Localization Mode"
|
591 |
)
|
592 |
font_selector_i = gr.Dropdown(
|
|
|
654 |
# Add examples here
|
655 |
gr.Examples(
|
656 |
examples=[
|
657 |
+
["assets/chinese.png", "Simplified Chinese", "English", "Basic (speech bubbles only)", "omniscript_bold", "#000000"],
|
658 |
+
["assets/chinese.png", "Simplified Chinese", "English", "Advanced (all text)", "Ldfcomicsansbold", "#d31515"],
|
659 |
+
["assets/korean.png", "Korean", "Spanish", "Basic (speech bubbles only)", "omniscript_bold", "#000000"],
|
660 |
+
["assets/chinese.png", "English", "French", "Basic (speech bubbles only)", "omniscript_bold", "#000000"],
|
661 |
],
|
662 |
inputs=[input_image, source_language, target_language, localization_mode, font_selector_i, font_color_picker_i]
|
663 |
)
|