Spaces:
Running
on
Zero
Running
on
Zero
carpelan
commited on
Commit
·
bb209bb
1
Parent(s):
6baad51
minor chnages to fix css and huminfra logo
Browse files- app/content/main_sub_title_hum.md +1 -3
- app/content/main_title.md +1 -1
- app/gradio_config.py +6 -0
- app/main.py +5 -12
- app/tabs/export.py +1 -3
- app/tabs/submit.py +2 -1
- app/tabs/visualizer.py +5 -15
app/content/main_sub_title_hum.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<a href="https://www.huminfra.se/">
|
2 |
-
<
|
3 |
-
<img src="https://www.umu.se/globalassets/qbank/huminfra-till-webben-48568w600h600.jpg"
|
4 |
width="60%"
|
5 |
style="margin-top: 0.3rem; border-radius: 0.5rem;" />
|
6 |
-
</center>
|
7 |
</a>
|
|
|
1 |
<a href="https://www.huminfra.se/">
|
2 |
+
<img src="https://www.umu.se/globalassets/qbank/huminfra-till-webben-48568w600h600.jpg"
|
|
|
3 |
width="60%"
|
4 |
style="margin-top: 0.3rem; border-radius: 0.5rem;" />
|
|
|
5 |
</a>
|
app/content/main_title.md
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<h1
|
|
|
1 |
+
<h1>HTRflow 🔍</h1>
|
app/gradio_config.py
CHANGED
@@ -115,4 +115,10 @@ hr.region-divider {
|
|
115 |
height: auto !important;
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
"""
|
|
|
115 |
height: auto !important;
|
116 |
}
|
117 |
|
118 |
+
.title-h1 {
|
119 |
+
text-align: center;
|
120 |
+
display:block;
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
"""
|
app/main.py
CHANGED
@@ -64,19 +64,16 @@ with gr.Blocks(
|
|
64 |
css=css,
|
65 |
head=matomo,
|
66 |
) as demo:
|
67 |
-
|
68 |
-
gr.Markdown(load_markdown(None, "main_title"))
|
69 |
|
70 |
with gr.Sidebar(label="Menu"):
|
71 |
-
gr.
|
72 |
gr.Markdown(load_markdown(None, "sidebar"))
|
73 |
|
74 |
with gr.Tabs(elem_classes="top-navbar") as navbar:
|
75 |
with gr.Tab(label="1. Upload") as tab_submit:
|
76 |
submit.render()
|
77 |
-
with gr.Tab(
|
78 |
-
label="2. Result", interactive=False, id="result"
|
79 |
-
) as tab_visualizer:
|
80 |
visualizer.render()
|
81 |
|
82 |
with gr.Tab(label="3. Export", interactive=False) as tab_export:
|
@@ -91,9 +88,7 @@ with gr.Blocks(
|
|
91 |
state_value = input_value
|
92 |
return state_value if state_value is not None else gr.skip()
|
93 |
|
94 |
-
collection_submit_state.change(
|
95 |
-
activate_tab, collection_submit_state, tab_visualizer
|
96 |
-
)
|
97 |
collection_submit_state.change(activate_tab, collection_submit_state, tab_export)
|
98 |
collection_submit_state.change(lambda: gr.Tabs(selected="result"), outputs=navbar)
|
99 |
|
@@ -112,6 +107,4 @@ with gr.Blocks(
|
|
112 |
demo.queue()
|
113 |
|
114 |
if __name__ == "__main__":
|
115 |
-
demo.launch(
|
116 |
-
server_name="0.0.0.0", server_port=7860, enable_monitoring=False, show_api=False
|
117 |
-
)
|
|
|
64 |
css=css,
|
65 |
head=matomo,
|
66 |
) as demo:
|
67 |
+
gr.Markdown(load_markdown(None, "main_title"), elem_classes="title-h1")
|
|
|
68 |
|
69 |
with gr.Sidebar(label="Menu"):
|
70 |
+
gr.HTML(load_markdown(None, "main_sub_title_hum"))
|
71 |
gr.Markdown(load_markdown(None, "sidebar"))
|
72 |
|
73 |
with gr.Tabs(elem_classes="top-navbar") as navbar:
|
74 |
with gr.Tab(label="1. Upload") as tab_submit:
|
75 |
submit.render()
|
76 |
+
with gr.Tab(label="2. Result", interactive=False, id="result") as tab_visualizer:
|
|
|
|
|
77 |
visualizer.render()
|
78 |
|
79 |
with gr.Tab(label="3. Export", interactive=False) as tab_export:
|
|
|
88 |
state_value = input_value
|
89 |
return state_value if state_value is not None else gr.skip()
|
90 |
|
91 |
+
collection_submit_state.change(activate_tab, collection_submit_state, tab_visualizer)
|
|
|
|
|
92 |
collection_submit_state.change(activate_tab, collection_submit_state, tab_export)
|
93 |
collection_submit_state.change(lambda: gr.Tabs(selected="result"), outputs=navbar)
|
94 |
|
|
|
107 |
demo.queue()
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, enable_monitoring=False, show_api=False)
|
|
|
|
app/tabs/export.py
CHANGED
@@ -78,9 +78,7 @@ with gr.Blocks() as export:
|
|
78 |
multiselect=True,
|
79 |
interactive=True,
|
80 |
)
|
81 |
-
export_button = gr.Button(
|
82 |
-
"Export", scale=0, min_width=200, variant="primary"
|
83 |
-
)
|
84 |
|
85 |
with gr.Column(scale=1):
|
86 |
download_files = gr.Files(label="Download files", interactive=False)
|
|
|
78 |
multiselect=True,
|
79 |
interactive=True,
|
80 |
)
|
81 |
+
export_button = gr.Button("Export", scale=0, min_width=200, variant="primary")
|
|
|
|
|
82 |
|
83 |
with gr.Column(scale=1):
|
84 |
download_files = gr.Files(label="Download files", interactive=False)
|
app/tabs/submit.py
CHANGED
@@ -179,7 +179,6 @@ def get_image_from_image_url(input_value):
|
|
179 |
|
180 |
|
181 |
with gr.Blocks() as submit:
|
182 |
-
|
183 |
with gr.Row():
|
184 |
with gr.Column():
|
185 |
gr.Markdown("# Upload")
|
@@ -213,6 +212,8 @@ with gr.Blocks() as submit:
|
|
213 |
height="45vh",
|
214 |
elem_classes="gallery-fix",
|
215 |
)
|
|
|
|
|
216 |
image_iiif_url = gr.Textbox(
|
217 |
label="Upload by image ID",
|
218 |
info=(
|
|
|
179 |
|
180 |
|
181 |
with gr.Blocks() as submit:
|
|
|
182 |
with gr.Row():
|
183 |
with gr.Column():
|
184 |
gr.Markdown("# Upload")
|
|
|
212 |
height="45vh",
|
213 |
elem_classes="gallery-fix",
|
214 |
)
|
215 |
+
# with Modal(visible=False) as edit_pipeline_modal:
|
216 |
+
|
217 |
image_iiif_url = gr.Textbox(
|
218 |
label="Upload by image ID",
|
219 |
info=(
|
app/tabs/visualizer.py
CHANGED
@@ -71,9 +71,7 @@ with gr.Blocks() as visualizer:
|
|
71 |
|
72 |
image_caption = gr.Markdown(elem_classes="button-group-viz")
|
73 |
with gr.Row(elem_classes="button-group-viz"):
|
74 |
-
left = gr.Button(
|
75 |
-
"← Previous", visible=False, interactive=False, scale=0
|
76 |
-
)
|
77 |
right = gr.Button("Next →", visible=False, scale=0)
|
78 |
|
79 |
# Transcription panel
|
@@ -92,18 +90,14 @@ with gr.Blocks() as visualizer:
|
|
92 |
|
93 |
# Wiring of navigation buttons
|
94 |
left.click(left_button_click, current_page_index, current_page_index)
|
95 |
-
right.click(
|
96 |
-
right_button_click, [collection, current_page_index], current_page_index
|
97 |
-
)
|
98 |
|
99 |
# Updates on collection change:
|
100 |
# - update the view
|
101 |
# - reset the page index (always start on page 0)
|
102 |
# - toggle visibility of navigation buttons (don't show them for single pages)
|
103 |
# - update the image caption
|
104 |
-
collection.change(
|
105 |
-
render_image, inputs=[collection, current_page_index], outputs=image
|
106 |
-
)
|
107 |
collection.change(
|
108 |
render_transcription,
|
109 |
inputs=[collection, current_page_index],
|
@@ -122,18 +116,14 @@ with gr.Blocks() as visualizer:
|
|
122 |
# - update the view
|
123 |
# - activate/deactivate buttons
|
124 |
# - update the image caption
|
125 |
-
current_page_index.change(
|
126 |
-
render_image, inputs=[collection, current_page_index], outputs=image
|
127 |
-
)
|
128 |
current_page_index.change(
|
129 |
render_transcription,
|
130 |
inputs=[collection, current_page_index],
|
131 |
outputs=transcription,
|
132 |
)
|
133 |
current_page_index.change(activate_left_button, current_page_index, left)
|
134 |
-
current_page_index.change(
|
135 |
-
activate_right_button, [collection, current_page_index], right
|
136 |
-
)
|
137 |
current_page_index.change(
|
138 |
update_image_caption,
|
139 |
inputs=[collection, current_page_index],
|
|
|
71 |
|
72 |
image_caption = gr.Markdown(elem_classes="button-group-viz")
|
73 |
with gr.Row(elem_classes="button-group-viz"):
|
74 |
+
left = gr.Button("← Previous", visible=False, interactive=False, scale=0)
|
|
|
|
|
75 |
right = gr.Button("Next →", visible=False, scale=0)
|
76 |
|
77 |
# Transcription panel
|
|
|
90 |
|
91 |
# Wiring of navigation buttons
|
92 |
left.click(left_button_click, current_page_index, current_page_index)
|
93 |
+
right.click(right_button_click, [collection, current_page_index], current_page_index)
|
|
|
|
|
94 |
|
95 |
# Updates on collection change:
|
96 |
# - update the view
|
97 |
# - reset the page index (always start on page 0)
|
98 |
# - toggle visibility of navigation buttons (don't show them for single pages)
|
99 |
# - update the image caption
|
100 |
+
collection.change(render_image, inputs=[collection, current_page_index], outputs=image)
|
|
|
|
|
101 |
collection.change(
|
102 |
render_transcription,
|
103 |
inputs=[collection, current_page_index],
|
|
|
116 |
# - update the view
|
117 |
# - activate/deactivate buttons
|
118 |
# - update the image caption
|
119 |
+
current_page_index.change(render_image, inputs=[collection, current_page_index], outputs=image)
|
|
|
|
|
120 |
current_page_index.change(
|
121 |
render_transcription,
|
122 |
inputs=[collection, current_page_index],
|
123 |
outputs=transcription,
|
124 |
)
|
125 |
current_page_index.change(activate_left_button, current_page_index, left)
|
126 |
+
current_page_index.change(activate_right_button, [collection, current_page_index], right)
|
|
|
|
|
127 |
current_page_index.change(
|
128 |
update_image_caption,
|
129 |
inputs=[collection, current_page_index],
|