Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -26,27 +26,27 @@ except ImportError as e:
|
|
| 26 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 27 |
print(f"Using device: {device}")
|
| 28 |
|
| 29 |
-
colors.
|
| 30 |
-
name="
|
| 31 |
-
c50="#
|
| 32 |
-
c100="#
|
| 33 |
-
c200="#
|
| 34 |
-
c300="#
|
| 35 |
-
c400="#
|
| 36 |
-
c500="#
|
| 37 |
-
c600="#
|
| 38 |
-
c700="#
|
| 39 |
-
c800="#
|
| 40 |
-
c900="#
|
| 41 |
-
c950="#
|
| 42 |
)
|
| 43 |
|
| 44 |
-
class
|
| 45 |
def __init__(
|
| 46 |
self,
|
| 47 |
*,
|
| 48 |
primary_hue: colors.Color | str = colors.gray,
|
| 49 |
-
secondary_hue: colors.Color | str = colors.
|
| 50 |
neutral_hue: colors.Color | str = colors.slate,
|
| 51 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 52 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -75,6 +75,12 @@ class SteelBlueTheme(Soft):
|
|
| 75 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 76 |
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 77 |
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
slider_color="*secondary_500",
|
| 79 |
slider_color_dark="*secondary_600",
|
| 80 |
block_title_text_weight="600",
|
|
@@ -86,7 +92,8 @@ class SteelBlueTheme(Soft):
|
|
| 86 |
block_label_background_fill="*primary_200",
|
| 87 |
)
|
| 88 |
|
| 89 |
-
|
|
|
|
| 90 |
css = """
|
| 91 |
#main-title h1 { font-size: 2.3em !important; }
|
| 92 |
#output-title h2 { font-size: 2.1em !important; }
|
|
@@ -191,7 +198,7 @@ def process_ocr_task(image):
|
|
| 191 |
|
| 192 |
return final_output_text, result_image
|
| 193 |
|
| 194 |
-
with gr.Blocks(css=css, theme=
|
| 195 |
gr.Markdown("# **NVIDIA Nemotron Parse v1.1**", elem_id="main-title")
|
| 196 |
gr.Markdown("Upload a document image to extract text, tables, and layout structures using NVIDIA's Nemotron Parse model.")
|
| 197 |
|
|
@@ -201,7 +208,7 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
|
| 201 |
submit_btn = gr.Button("Process Document", variant="primary")
|
| 202 |
|
| 203 |
examples = gr.Examples(
|
| 204 |
-
examples=["examples/1.jpg", "examples/2.jpg", "examples/3.jpg"],
|
| 205 |
inputs=image_input,
|
| 206 |
label="Examples"
|
| 207 |
)
|
|
|
|
| 26 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 27 |
print(f"Using device: {device}")
|
| 28 |
|
| 29 |
+
colors.orange_red = colors.Color(
|
| 30 |
+
name="orange_red",
|
| 31 |
+
c50="#FFF0E5",
|
| 32 |
+
c100="#FFE0CC",
|
| 33 |
+
c200="#FFC299",
|
| 34 |
+
c300="#FFA366",
|
| 35 |
+
c400="#FF8533",
|
| 36 |
+
c500="#FF4500",
|
| 37 |
+
c600="#E63E00",
|
| 38 |
+
c700="#CC3700",
|
| 39 |
+
c800="#B33000",
|
| 40 |
+
c900="#992900",
|
| 41 |
+
c950="#802200",
|
| 42 |
)
|
| 43 |
|
| 44 |
+
class OrangeRedTheme(Soft):
|
| 45 |
def __init__(
|
| 46 |
self,
|
| 47 |
*,
|
| 48 |
primary_hue: colors.Color | str = colors.gray,
|
| 49 |
+
secondary_hue: colors.Color | str = colors.orange_red,
|
| 50 |
neutral_hue: colors.Color | str = colors.slate,
|
| 51 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 52 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 75 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 76 |
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 77 |
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 78 |
+
button_secondary_text_color="black",
|
| 79 |
+
button_secondary_text_color_hover="white",
|
| 80 |
+
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 81 |
+
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 82 |
+
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 83 |
+
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 84 |
slider_color="*secondary_500",
|
| 85 |
slider_color_dark="*secondary_600",
|
| 86 |
block_title_text_weight="600",
|
|
|
|
| 92 |
block_label_background_fill="*primary_200",
|
| 93 |
)
|
| 94 |
|
| 95 |
+
orange_red_theme = OrangeRedTheme()
|
| 96 |
+
|
| 97 |
css = """
|
| 98 |
#main-title h1 { font-size: 2.3em !important; }
|
| 99 |
#output-title h2 { font-size: 2.1em !important; }
|
|
|
|
| 198 |
|
| 199 |
return final_output_text, result_image
|
| 200 |
|
| 201 |
+
with gr.Blocks(css=css, theme=orange_red_theme) as demo:
|
| 202 |
gr.Markdown("# **NVIDIA Nemotron Parse v1.1**", elem_id="main-title")
|
| 203 |
gr.Markdown("Upload a document image to extract text, tables, and layout structures using NVIDIA's Nemotron Parse model.")
|
| 204 |
|
|
|
|
| 208 |
submit_btn = gr.Button("Process Document", variant="primary")
|
| 209 |
|
| 210 |
examples = gr.Examples(
|
| 211 |
+
examples=["examples/1.jpg", "examples/2.jpg", "examples/3.jpg", "examples/4.jpg"],
|
| 212 |
inputs=image_input,
|
| 213 |
label="Examples"
|
| 214 |
)
|