Spaces:
Sleeping
Sleeping
small changes for text
Browse files- app.py +1 -2
- helper/text/help/faq.md +5 -6
- helper/text/text_app.py +2 -0
- helper/text/text_help.py +52 -34
- helper/text/text_roadmap.py +3 -3
- tabs/about_tab.py +8 -8
- tabs/help_tab.py +39 -15
- tabs/htr_tool.py +1 -1
app.py
CHANGED
@@ -12,12 +12,11 @@ from tabs.htr_tool import htr_tool_tab
|
|
12 |
from tabs.stepwise_htr_tool import stepwise_htr_tool_tab
|
13 |
|
14 |
session_uuid = str(uuid.uuid1())
|
15 |
-
VERSION = "Demo version 0.0.2"
|
16 |
|
17 |
with gr.Blocks(title="Riksarkivet", theme=theme, css=css) as demo:
|
18 |
with gr.Row():
|
19 |
with gr.Column(scale=1):
|
20 |
-
text_ip_output = gr.Markdown(
|
21 |
with gr.Column(scale=1):
|
22 |
gr.Markdown(TextApp.title_markdown)
|
23 |
with gr.Column(scale=1):
|
|
|
12 |
from tabs.stepwise_htr_tool import stepwise_htr_tool_tab
|
13 |
|
14 |
session_uuid = str(uuid.uuid1())
|
|
|
15 |
|
16 |
with gr.Blocks(title="Riksarkivet", theme=theme, css=css) as demo:
|
17 |
with gr.Row():
|
18 |
with gr.Column(scale=1):
|
19 |
+
text_ip_output = gr.Markdown(TextApp.demo_version)
|
20 |
with gr.Column(scale=1):
|
21 |
gr.Markdown(TextApp.title_markdown)
|
22 |
with gr.Column(scale=1):
|
helper/text/help/faq.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
## Frequently asked questions
|
2 |
|
3 |
-
|
4 |
-
**A** : Click on the 'Sign Up' button on the top right corner of our homepage. Fill in the required details, and you'll be set up in no time!
|
5 |
|
6 |
-
Q
|
7 |
-
A
|
8 |
|
9 |
-
Q
|
10 |
-
A
|
|
|
1 |
## Frequently asked questions
|
2 |
|
3 |
+
WIP
|
|
|
4 |
|
5 |
+
**Q**: <u>Is my data secure?</u>
|
6 |
+
**A**: Absolutely. We prioritize user data security and have implemented robust encryption methods to ensure your data remains private and protected.
|
7 |
|
8 |
+
**Q**: <u>Who can I contact for technical support?</u>
|
9 |
+
**A**: Please reach out to our support team at [email protected] for any technical queries.
|
helper/text/text_app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
class TextApp:
|
|
|
|
|
2 |
title_markdown = """
|
3 |
|
4 |
|
|
|
1 |
class TextApp:
|
2 |
+
demo_version = """Demo version 0.0.1"""
|
3 |
+
|
4 |
title_markdown = """
|
5 |
|
6 |
|
helper/text/text_help.py
CHANGED
@@ -34,13 +34,12 @@ class TextHowTo:
|
|
34 |
stepwise_htr_tool = """
|
35 |
## Stepwise HTR Tool
|
36 |
|
37 |
-
|
38 |
-
With the Stepwise HTR Tool, you can break down the HTR process into distinct steps: region segmentation, line segmentation, text transcription, and result exploration. This tool offers a range of configuration options to tailor the HTR process to your specific needs. You can adjust settings such as P-threshold and C-threshold to fine-tune the region and line segmentation, and choose from a selection of underlying machine learning models to drive each step of the process. <br>
|
39 |
-
The Stepwise HTR Tool also provides a dedicated Explore Results tab, allowing you to thoroughly analyze and interact with the transcriptions. You can sort and identify both bad and good predictions, helping you gain insights and make improvements to the HTR accuracy. Each step is interconnected, and the output of one step serves as the input for the next step, ensuring a seamless and efficient workflow.
|
40 |
-
|
41 |
"""
|
42 |
stepwise_htr_tool_tab_intro = """
|
43 |
-
|
|
|
|
|
44 |
|
45 |
"""
|
46 |
|
@@ -122,9 +121,9 @@ Alternatively, you can watch the instructional video below, which provides a ste
|
|
122 |
</figure>
|
123 |
"""
|
124 |
duplicatin_space_htr_text = """
|
125 |
-
## Duplicating for
|
126 |
|
127 |
-
It's worth noting that while using any
|
128 |
|
129 |
<br>
|
130 |
<p align="center">
|
@@ -155,33 +154,44 @@ job = client.submit(
|
|
155 |
|
156 |
print(job.result())
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
# <Metadata>
|
162 |
-
# <Creator>Swedish National Archives</Creator>
|
163 |
-
# <Created>2023-08-21, 13:28:06</Created>
|
164 |
-
# </Metadata>
|
165 |
-
# <Page imageFilename="page_xml.xml" imageWidth="4885" imageHeight="4066">
|
166 |
-
# <TextRegion id="region_0" custom="readingOrder {index:0;}">
|
167 |
-
# <Coords points="1477,265 1467,217 1440,201 1370,211 1248,203 1127,224 1067,224 1003,212 844,247 766,243 747,261 742,280 751,332 766,346 1258,341 1357,332 1439,341 1468,327"/>
|
168 |
-
# <TextLine id="line_region_0_0" custom="readingOrder {index:0;}">
|
169 |
-
# <Coords points="1458,248 1443,222 1449,200 1412,215 1366,200 1325,207 1302,200 1241,200 1235,206 1205,200 1187,210 1085,222 957,206 795,239 769,273 771,333 783,340 1445,333 1450,324"/>
|
170 |
-
# <TextEquiv>
|
171 |
-
# <Unicode>År 1865.</Unicode>
|
172 |
-
# </TextEquiv>
|
173 |
-
# <PredScore pred_score="0.9482"/>
|
174 |
-
# </TextLine>
|
175 |
-
# </TextRegion>
|
176 |
-
# <TextRegion id="region_1" custom="readingOrder {index:1;}">
|
177 |
-
# ......................................
|
178 |
-
# </TextRegion>
|
179 |
-
# </Page>
|
180 |
-
# </PcGts>
|
181 |
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
-
|
|
|
185 |
|
186 |
text_faq = read_markdown("helper/text/help/faq.md")
|
187 |
|
@@ -190,7 +200,7 @@ print(job.result())
|
|
190 |
"""
|
191 |
|
192 |
discussion = """
|
193 |
-
##
|
194 |
|
195 |
If you have suggestions, questions, or would like to discuss our roadmap further, please don't hesitate to reach out.
|
196 |
Press badge below to open a discussion on HuggingFace.
|
@@ -199,7 +209,15 @@ print(job.result())
|
|
199 |
<a href="https://huggingface.co/spaces/Riksarkivet/htr_demo/discussions">
|
200 |
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl-dark.svg" alt="Badge 1">
|
201 |
</a>
|
202 |
-
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
|
205 |
if __name__ == "__main__":
|
|
|
34 |
stepwise_htr_tool = """
|
35 |
## Stepwise HTR Tool
|
36 |
|
37 |
+
Here you can break down the HTR process into distinct steps: Region segmentation, Line segmentation, Text recognition, and Explore results. You can adjust the settings for each part, and choose from a selection of underlying machine learning models to drive each step of the process. Each step is interconnected, and the output of one step serves as the input for the next step, ensuring a seamless and efficient workflow.
|
|
|
|
|
|
|
38 |
"""
|
39 |
stepwise_htr_tool_tab_intro = """
|
40 |
+
Follow the instructions below:
|
41 |
+
|
42 |
+
|
43 |
|
44 |
"""
|
45 |
|
|
|
121 |
</figure>
|
122 |
"""
|
123 |
duplicatin_space_htr_text = """
|
124 |
+
## Duplicating for own Use
|
125 |
|
126 |
+
It's worth noting that while using any poublic Space as an API is possible, there's a catch. Hugging Face might rate limit you if you send an excessive number of requests in a short period. However, there's a workaround for those who need to make frequent API calls. By duplicating a public Space, you can create your own private Space. This private version allows you to make unlimited requests without any restrictions. So, if you're planning on heavy usage duplicate space:
|
127 |
|
128 |
<br>
|
129 |
<p align="center">
|
|
|
154 |
|
155 |
print(job.result())
|
156 |
|
157 |
+
"""
|
158 |
+
output_code_for_api_text = """
|
159 |
+
### Output from the api
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
+
The output from the api is currently in the format of Page XML, which can be imported into transkibus or be viewed in this [viewer](https://huggingface.co/spaces/Riksarkivet/Viewer_demo).
|
162 |
+
|
163 |
+
|
164 |
+
"""
|
165 |
+
|
166 |
+
output_code_for_api = """
|
167 |
+
|
168 |
+
|
169 |
+
Loaded as API: http://127.0.0.1:7860/ ✔
|
170 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
171 |
+
<PcGts xmlns="http://schema.primaresearch.org/PAGE/gts/pagecontent/2013-07-15" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.primaresearch.org/PAGE/gts/pagecontent/2013-07-15 http://schema.primaresearch.org/PAGE/gts/pagecontent/2013-07-15/pagecontent.xsd">
|
172 |
+
<Metadata>
|
173 |
+
<Creator>Swedish National Archives</Creator>
|
174 |
+
<Created>2023-08-21, 13:28:06</Created>
|
175 |
+
</Metadata>
|
176 |
+
<Page imageFilename="page_xml.xml" imageWidth="4885" imageHeight="4066">
|
177 |
+
<TextRegion id="region_0" custom="readingOrder {index:0;}">
|
178 |
+
<Coords points="1477,265 1467,217 1440,201 1370,211 1248,203 1127,224 1067,224 1003,212 844,247 766,243 747,261 742,280 751,332 766,346 1258,341 1357,332 1439,341 1468,327"/>
|
179 |
+
<TextLine id="line_region_0_0" custom="readingOrder {index:0;}">
|
180 |
+
<Coords points="1458,248 1443,222 1449,200 1412,215 1366,200 1325,207 1302,200 1241,200 1235,206 1205,200 1187,210 1085,222 957,206 795,239 769,273 771,333 783,340 1445,333 1450,324"/>
|
181 |
+
<TextEquiv>
|
182 |
+
<Unicode>År 1865.</Unicode>
|
183 |
+
</TextEquiv>
|
184 |
+
<PredScore pred_score="0.9482"/>
|
185 |
+
</TextLine>
|
186 |
+
</TextRegion>
|
187 |
+
<TextRegion id="region_1" custom="readingOrder {index:1;}">
|
188 |
+
......................................
|
189 |
+
</TextRegion>
|
190 |
+
</Page>
|
191 |
+
</PcGts>
|
192 |
|
193 |
+
# Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
|
194 |
+
"""
|
195 |
|
196 |
text_faq = read_markdown("helper/text/help/faq.md")
|
197 |
|
|
|
200 |
"""
|
201 |
|
202 |
discussion = """
|
203 |
+
## Discussion about the app
|
204 |
|
205 |
If you have suggestions, questions, or would like to discuss our roadmap further, please don't hesitate to reach out.
|
206 |
Press badge below to open a discussion on HuggingFace.
|
|
|
209 |
<a href="https://huggingface.co/spaces/Riksarkivet/htr_demo/discussions">
|
210 |
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl-dark.svg" alt="Badge 1">
|
211 |
</a>
|
212 |
+
</p>
|
213 |
+
|
214 |
+
## Open discussion
|
215 |
+
DIGG...
|
216 |
+
|
217 |
+
## Contact us
|
218 |
+
email..
|
219 |
+
|
220 |
+
"""
|
221 |
|
222 |
|
223 |
if __name__ == "__main__":
|
helper/text/text_roadmap.py
CHANGED
@@ -26,7 +26,7 @@ class TextRoadmap:
|
|
26 |
|
27 |
changelog = """
|
28 |
|
29 |
-
##
|
30 |
|
31 |
### [0.0.1] - 2023-10-19
|
32 |
|
@@ -36,7 +36,7 @@ class TextRoadmap:
|
|
36 |
|
37 |
#### Fixed
|
38 |
|
39 |
-
-
|
40 |
|
41 |
#### Changed
|
42 |
|
@@ -44,7 +44,7 @@ class TextRoadmap:
|
|
44 |
|
45 |
### Removed
|
46 |
|
47 |
-
-
|
48 |
|
49 |
|
50 |
"""
|
|
|
26 |
|
27 |
changelog = """
|
28 |
|
29 |
+
## Changelog
|
30 |
|
31 |
### [0.0.1] - 2023-10-19
|
32 |
|
|
|
36 |
|
37 |
#### Fixed
|
38 |
|
39 |
+
- -
|
40 |
|
41 |
#### Changed
|
42 |
|
|
|
44 |
|
45 |
### Removed
|
46 |
|
47 |
+
- -
|
48 |
|
49 |
|
50 |
"""
|
tabs/about_tab.py
CHANGED
@@ -6,9 +6,6 @@ from helper.text.text_roadmap import TextRoadmap
|
|
6 |
with gr.Blocks() as about_tab:
|
7 |
with gr.Tabs():
|
8 |
with gr.Tab("HTRFLOW"):
|
9 |
-
gr.Markdown(
|
10 |
-
"update... todo.. here we should talk about the pipline and the app as seperate things... pipline overview perhaps be moved?"
|
11 |
-
)
|
12 |
with gr.Row():
|
13 |
with gr.Column():
|
14 |
gr.Markdown(TextAbout.intro_text)
|
@@ -18,13 +15,13 @@ with gr.Blocks() as about_tab:
|
|
18 |
gr.Markdown(TextAbout.pipeline_overview_text)
|
19 |
with gr.Row():
|
20 |
with gr.Tabs():
|
21 |
-
with gr.Tab("
|
22 |
gr.Markdown(TextAbout.binarization)
|
23 |
-
with gr.Tab("
|
24 |
gr.Markdown(TextAbout.text_region_segment)
|
25 |
-
with gr.Tab("
|
26 |
gr.Markdown(TextAbout.text_line_segmentation)
|
27 |
-
with gr.Tab("
|
28 |
gr.Markdown(TextAbout.text_htr)
|
29 |
|
30 |
with gr.Tab("Contributions"):
|
@@ -34,6 +31,9 @@ with gr.Blocks() as about_tab:
|
|
34 |
with gr.Tab("Changelog & Roadmap"):
|
35 |
with gr.Row():
|
36 |
with gr.Column():
|
37 |
-
gr.
|
|
|
|
|
|
|
38 |
with gr.Column():
|
39 |
gr.Markdown(TextRoadmap.roadmap)
|
|
|
6 |
with gr.Blocks() as about_tab:
|
7 |
with gr.Tabs():
|
8 |
with gr.Tab("HTRFLOW"):
|
|
|
|
|
|
|
9 |
with gr.Row():
|
10 |
with gr.Column():
|
11 |
gr.Markdown(TextAbout.intro_text)
|
|
|
15 |
gr.Markdown(TextAbout.pipeline_overview_text)
|
16 |
with gr.Row():
|
17 |
with gr.Tabs():
|
18 |
+
with gr.Tab("Binarization"):
|
19 |
gr.Markdown(TextAbout.binarization)
|
20 |
+
with gr.Tab("Region segmentation"):
|
21 |
gr.Markdown(TextAbout.text_region_segment)
|
22 |
+
with gr.Tab("Line segmentation"):
|
23 |
gr.Markdown(TextAbout.text_line_segmentation)
|
24 |
+
with gr.Tab("Text recognition"):
|
25 |
gr.Markdown(TextAbout.text_htr)
|
26 |
|
27 |
with gr.Tab("Contributions"):
|
|
|
31 |
with gr.Tab("Changelog & Roadmap"):
|
32 |
with gr.Row():
|
33 |
with gr.Column():
|
34 |
+
with gr.Accordion("Current Changelog", open=True):
|
35 |
+
gr.Markdown(TextRoadmap.changelog)
|
36 |
+
with gr.Accordion("Old Changelog", open=False):
|
37 |
+
pass
|
38 |
with gr.Column():
|
39 |
gr.Markdown(TextRoadmap.roadmap)
|
tabs/help_tab.py
CHANGED
@@ -12,23 +12,40 @@ with gr.Blocks() as help_tab:
|
|
12 |
gr.Markdown(TextHowTo.discussion)
|
13 |
|
14 |
with gr.Tab("Fast track"):
|
|
|
15 |
pass
|
16 |
with gr.Tab("Stepwise"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
with gr.Row():
|
18 |
-
with gr.Row(equal_height=False):
|
19 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool)
|
20 |
-
with gr.Row():
|
21 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool_tab_intro)
|
22 |
-
with gr.Row():
|
23 |
-
with gr.Tabs():
|
24 |
-
with gr.Tab("1. Region Segmentation"):
|
25 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool_tab1)
|
26 |
-
with gr.Tab("2. Line Segmentation"):
|
27 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool_tab2)
|
28 |
-
with gr.Tab("3. Transcribe Text"):
|
29 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool_tab3)
|
30 |
-
with gr.Tab("4. Explore Results"):
|
31 |
-
gr.Markdown(TextHowTo.stepwise_htr_tool_tab4)
|
32 |
gr.Markdown(TextHowTo.stepwise_htr_tool_end)
|
33 |
|
34 |
with gr.Tab("API"):
|
@@ -42,7 +59,14 @@ with gr.Blocks() as help_tab:
|
|
42 |
show_label=False,
|
43 |
)
|
44 |
with gr.Column():
|
45 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
pass
|
48 |
with gr.Tab("Duplicating for own use"):
|
|
|
12 |
gr.Markdown(TextHowTo.discussion)
|
13 |
|
14 |
with gr.Tab("Fast track"):
|
15 |
+
gr.Markdown("WIP")
|
16 |
pass
|
17 |
with gr.Tab("Stepwise"):
|
18 |
+
with gr.Row(equal_height=False):
|
19 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool)
|
20 |
+
with gr.Row():
|
21 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool_tab_intro)
|
22 |
+
with gr.Row():
|
23 |
+
with gr.Tabs():
|
24 |
+
with gr.Tab("1. Region Segmentation"):
|
25 |
+
with gr.Row():
|
26 |
+
with gr.Column():
|
27 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool_tab1)
|
28 |
+
with gr.Column():
|
29 |
+
gr.Markdown("image")
|
30 |
+
with gr.Tab("2. Line Segmentation"):
|
31 |
+
with gr.Row():
|
32 |
+
with gr.Column():
|
33 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool_tab2)
|
34 |
+
with gr.Column():
|
35 |
+
gr.Markdown("image")
|
36 |
+
with gr.Tab("3. Transcribe Text"):
|
37 |
+
with gr.Row():
|
38 |
+
with gr.Column():
|
39 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool_tab3)
|
40 |
+
with gr.Column():
|
41 |
+
gr.Markdown("image")
|
42 |
+
with gr.Tab("4. Explore Results"):
|
43 |
+
with gr.Row():
|
44 |
+
with gr.Column():
|
45 |
+
gr.Markdown(TextHowTo.stepwise_htr_tool_tab4)
|
46 |
+
with gr.Column():
|
47 |
+
gr.Markdown("image")
|
48 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
gr.Markdown(TextHowTo.stepwise_htr_tool_end)
|
50 |
|
51 |
with gr.Tab("API"):
|
|
|
59 |
show_label=False,
|
60 |
)
|
61 |
with gr.Column():
|
62 |
+
gr.Markdown(TextHowTo.output_code_for_api_text)
|
63 |
+
|
64 |
+
gr.Code(
|
65 |
+
value=TextHowTo.output_code_for_api,
|
66 |
+
language=None,
|
67 |
+
interactive=False,
|
68 |
+
show_label=False,
|
69 |
+
)
|
70 |
|
71 |
pass
|
72 |
with gr.Tab("Duplicating for own use"):
|
tabs/htr_tool.py
CHANGED
@@ -46,7 +46,7 @@ with gr.Blocks() as htr_tool_tab:
|
|
46 |
with gr.Tab("Visualize") as tab_image_viewer_selector:
|
47 |
with gr.Row():
|
48 |
gr.Button(
|
49 |
-
value="Image
|
50 |
variant="secondary",
|
51 |
link="https://huggingface.co/spaces/Riksarkivet/Viewer_demo",
|
52 |
interactive=True,
|
|
|
46 |
with gr.Tab("Visualize") as tab_image_viewer_selector:
|
47 |
with gr.Row():
|
48 |
gr.Button(
|
49 |
+
value="Image viewer",
|
50 |
variant="secondary",
|
51 |
link="https://huggingface.co/spaces/Riksarkivet/Viewer_demo",
|
52 |
interactive=True,
|