Gabriel commited on
Commit
69d1982
β€’
1 Parent(s): 6a5ac94

changes read me strucutre again

Browse files
app.py CHANGED
@@ -6,8 +6,8 @@ import gradio as gr
6
  from helper.gradio_config import css, theme
7
  from helper.text.text_app import TextApp
8
  from helper.utils import TrafficDataHandler
9
- from tabs.about_tab import about_tab
10
  from tabs.htr_tool import htr_tool_tab
 
11
  from tabs.stepwise_htr_tool import stepwise_htr_tool_tab
12
 
13
  session_uuid = str(uuid.uuid1())
@@ -28,8 +28,8 @@ with gr.Blocks(title="Riksarkivet", theme=theme, css=css) as demo:
28
  with gr.Tab("Stepwise"):
29
  stepwise_htr_tool_tab.render()
30
 
31
- with gr.Tab("Documentation"):
32
- about_tab.render()
33
 
34
  SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
35
  if SECRET_KEY:
 
6
  from helper.gradio_config import css, theme
7
  from helper.text.text_app import TextApp
8
  from helper.utils import TrafficDataHandler
 
9
  from tabs.htr_tool import htr_tool_tab
10
+ from tabs.overview_tab import overview
11
  from tabs.stepwise_htr_tool import stepwise_htr_tool_tab
12
 
13
  session_uuid = str(uuid.uuid1())
 
28
  with gr.Tab("Stepwise"):
29
  stepwise_htr_tool_tab.render()
30
 
31
+ with gr.Tab("Overview"):
32
+ overview.render()
33
 
34
  SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
35
  if SECRET_KEY:
helper/text/about/changelog_roadmap/current_changelog.md DELETED
@@ -1,15 +0,0 @@
1
- ## Changelog
2
-
3
- ### [0.0.1] - 2023-10-19
4
-
5
- #### Added
6
-
7
- - Stepwise feature > Explore results > New Text diff and CER components
8
-
9
- #### Fixed
10
-
11
- #### Changed
12
-
13
- - Layout in both Fast track and Stepwise to improve the UX
14
-
15
- #### Removed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helper/text/about/changelog_roadmap/old_changelog.md DELETED
@@ -1,15 +0,0 @@
1
- ## Changelog
2
-
3
- ### [0.0.1] - 2023-10-19
4
-
5
- #### Added
6
-
7
- - Stepwise feature > Explore results > New Text diff and CER components
8
-
9
- #### Fixed
10
-
11
- #### Changed
12
-
13
- - Layout in both Fast track and Stepwise to improve the UX
14
-
15
- #### Removed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helper/text/about/changelog_roadmap/roadmap.md DELETED
@@ -1,25 +0,0 @@
1
- ## Roadmap
2
-
3
- #### ☑ Release Model on HuggingFace
4
-
5
- - Continually retrain and update both segmentation and text-recognition models as more training data becomes available.
6
-
7
- #### ☐ Release Training and Eval data on HuggingFace
8
-
9
- #### ☐ Specialized TrOCR Model
10
-
11
- - Train a TrOCR model specialized on Swedish historical handwritten text.
12
- - Initialize with a historical BERT-model trained at the Swedish National Archives.
13
-
14
- #### ☐ Open-source and package HTR-pipeline for mass HTR
15
-
16
- - Develop an easy-to-implement pipeline like the demo.
17
- - Ensure high modularity:
18
- - Different segmentation strategies.
19
- - Integration of models from various frameworks.
20
- - Effective evaluation methods for entire pipelines and their comparisons.
21
- - Broad use-cases: Not just running text, but all types of handwritten archives.
22
-
23
- #### ☐ Inference Endpoints
24
-
25
- - Serve model through inference APIs / Rest APIs with dedicated hardware.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helper/text/overview/changelog_roadmap/changelog.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Changelog
2
+
3
+ ### [0.0.1] - 2023-10-19
4
+
5
+ #### Added
6
+
7
+ - Added a new feature to **Stepwise** > **Explore results** > New Text diff and CER component
8
+
9
+ #### Fixed
10
+
11
+ - Fixed naming conventions of tabs in app
12
+
13
+ #### Changed
14
+
15
+ - Changed the layout in both Fast track and Stepwise to improve the UX
16
+ - Examples are viewed in the middle of the layout
17
+ - "Advanced settings" are initial hidden
18
+
19
+ #### Removed
20
+
21
+ - Removed **help** tab for now (documentation of Fast track and Stepwise will come in a later release)
helper/text/overview/changelog_roadmap/roadmap.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Roadmap
2
+
3
+ - Release Training and Eval data on HuggingFace
4
+
5
+ - Specialized TrOCR Model
6
+ - Add support for TrOCR models as Text recognition model
7
+
8
+ - Train a TrOCR model specialized on Swedish historical handwritten text.
9
+
10
+ - Initial document classifier
11
+
12
+ - Optimize the backend of the application
13
+
14
+ - Package the code
15
+ - Add support for batch inference
16
+ - Start a collaborative open source project
17
+
18
+ - Add support for Different segmentation strategies
19
+
20
+ - Table detection
21
+ - Different text layouts with multiple columns
22
+
23
+ - Add more endpoints for the rest api and documentation
helper/text/{about β†’ overview}/contributions/contributions.md RENAMED
File without changes
helper/text/overview/duplicate_api/api1.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Usage of Client API
2
+
3
+ If you prefer to run **Fast track** programmatically, we offer an API for that purpose.
4
+
5
+ - Docuemtnation for gradio client with [python](https://www.gradio.app/guides/getting-started-with-the-python-client)
6
+ - Docuemtnation for gradio client with [javascript](https://www.gradio.app/guides/getting-started-with-the-js-client)
7
+
8
+ **Note**: More extensive APIs and documentation can be added in the future upon request.
9
+
10
+ See example below for usage of API in python:
helper/text/overview/duplicate_api/api2.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ### Output from the api
2
+
3
+ The output from the api is currently in the format of Page XML, which can be imported into this [viewer](https://huggingface.co/spaces/Riksarkivet/Viewer_demo).
helper/text/overview/duplicate_api/api_code1.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gradio_client import Client # pip install gradio_client
2
+
3
+ # Change url to your client (localhost: http://127.0.0.1:7860/)
4
+
5
+ client = Client("https://huggingface.co/spaces/Riksarkivet/htr_demo")
6
+ job = client.submit(
7
+ "https://your.image.url.or.pah.jpg",
8
+ api_name="/predict",
9
+ )
10
+
11
+ print(job.result())
helper/text/overview/duplicate_api/api_code2.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Loaded as API: http://127.0.0.1:7860/ βœ”
2
+
3
+ <?xml version="1.0" encoding="UTF-8"?>
4
+ <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">
5
+ <Metadata>
6
+ <Creator>Swedish National Archives</Creator>
7
+ <Created>2023-08-21, 13:28:06</Created>
8
+ </Metadata>
9
+ <Page imageFilename="page_xml.xml" imageWidth="4885" imageHeight="4066">
10
+ <TextRegion id="region_0" custom="readingOrder {index:0;}">
11
+ <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"/>
12
+ <TextLine id="line_region_0_0" custom="readingOrder {index:0;}">
13
+ <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"/>
14
+ <TextEquiv>
15
+ <Unicode>Γ…r 1865.</Unicode>
16
+ </TextEquiv>
17
+ <PredScore pred_score="0.9482"/>
18
+ </TextLine>
19
+ </TextRegion>
20
+ <TextRegion id="region_1" custom="readingOrder {index:1;}">
21
+ ......................................
22
+ </TextRegion>
23
+ </Page>
24
+ </PcGts>
25
+
26
+ # Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
helper/text/overview/duplicate_api/duplicate.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Duplicating for own use
2
+
3
+ Please be aware of certain limitations when using the application:
4
+
5
+ - Primarily, this application is designed for demonstration purposes and is not intended for mass HTR.
6
+ - Currently, the Swedish National Archives has constraints on sharing hardware, leading to a queue system for high demand.
7
+ - The demo is hosted on Hugging Face domains, and they may rate-limit you if there's an excessive number of requests in a short timeframe, especially when using the API.
8
+
9
+ For those requiring heavy usage, you can conveniently duplicate the application.
10
+
11
+ - Duplicate [application](https://huggingface.co/spaces/Riksarkivet/htr_demo?duplicate=true).
12
+
13
+ By doing so, you'll create your own private app, which allows for unlimited requests without any restrictions. The image below shows the minimum hardware you need to use if you don't have access to hardware youself:
14
+
15
+ <figure>
16
+
17
+ <img src="https://raw.githubusercontent.com/Borg93/htr_gradio_file_placeholder/main/hardware_example.png" alt="HTR_tool" style="width:75%; display: block; margin-left: auto; margin-right:auto;" >
18
+ <figcaption style="text-align: center;"> <em> Figure - Choose a hardware that has atleast a GPU </em></figcaption>
19
+ </figure>
20
+
21
+ For individuals with access to dedicated hardware, additional options are available. You have the flexibility to run this application on your own machine utilizing Docker, or by cloning the repository directly. Doing so allows you to leverage your hardware's capabilities to their fullest extent.
22
+
23
+ - [Clone with Docker](https://huggingface.co/spaces/Riksarkivet/htr_demo?docker=true)
24
+ - [Clone Repo](https://huggingface.co/spaces/Riksarkivet/htr_demo/settings?clone=true)
25
+
26
+ **Note**: To take advantage of CUDA for accelerated inferences, an Nvidia graphics card is required. This setup significantly enhances the performance, ensuring a smoother and faster operation.
helper/text/{help β†’ overview}/faq_discussion/discussion.md RENAMED
File without changes
helper/text/{help β†’ overview}/faq_discussion/faq.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_col1.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_col2.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_row1.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_tab1.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_tab2.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_tab3.md RENAMED
File without changes
helper/text/{about β†’ overview}/htrflow/htrflow_tab4.md RENAMED
File without changes
helper/text/text_about.py DELETED
@@ -1,32 +0,0 @@
1
- from helper.text.markdown_reader import read_markdown
2
-
3
-
4
- class TextAbout:
5
- # HTRFLOW
6
- htrflow_col1 = read_markdown("helper/text/about/htrflow/htrflow_col1.md")
7
-
8
- htrflow_col2 = read_markdown("helper/text/about/htrflow/htrflow_col2.md")
9
-
10
- htrflow_row1 = read_markdown("helper/text/about/htrflow/htrflow_row1.md")
11
-
12
- htrflow_tab1 = read_markdown("helper/text/about/htrflow/htrflow_tab1.md")
13
-
14
- htrflow_tab2 = read_markdown("helper/text/about/htrflow/htrflow_tab2.md")
15
-
16
- htrflow_tab3 = read_markdown("helper/text/about/htrflow/htrflow_tab3.md")
17
-
18
- htrflow_tab4 = read_markdown("helper/text/about/htrflow/htrflow_tab4.md")
19
-
20
- # Contributions
21
- contributions = read_markdown("helper/text/about/contributions/contributions.md")
22
-
23
- # Changelog & Roadmap
24
- current_changelog = read_markdown("helper/text/about/changelog_roadmap/current_changelog.md")
25
-
26
- old_changelog = read_markdown("helper/text/about/changelog_roadmap/old_changelog.md")
27
-
28
- roadmap = read_markdown("helper/text/about/changelog_roadmap/roadmap.md")
29
-
30
-
31
- if __name__ == "__main__":
32
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helper/text/text_help.py DELETED
@@ -1,216 +0,0 @@
1
- from helper.text.markdown_reader import read_markdown
2
-
3
-
4
- class TextHowTo:
5
- htr_tool = """
6
- ## Getting Started with the HTR Tool
7
- To quickly run the HTR Tool and transcribe handwritten text, follow these steps:
8
- 1. Open the HTR Tool tab.
9
- 2. Upload an image or choose an image from the provided Examples (under "Example images to use:" accordin).
10
- Note that the accordin works like a "dropdown" and that you just need to press an example to use it (also, use the pagniation at the bottom to view more examples).
11
- 3. The radio button specifes the output file extension, which can be either text or page XML.
12
- 4. Click the "Run HTR" button to initiate the HTR process. You can refer to the screenshot below:
13
- <figure>
14
- <img src="https://raw.githubusercontent.com/Borg93/htr_gradio_file_placeholder/main/htr_run_example.png" alt="HTR_tool" style="width:65%; display: block; margin-left: auto; margin-right:auto;" >
15
- <figcaption style="text-align: center;"> <em> Figure - How to Run the HTR Tool </em></figcaption>
16
- </figure>
17
- The HTR Tool will transform an image of handwritten text into structured, transcribed text within approximately 1-2 minutes (depending on your hardware).
18
- Note that the generated page XML file is strucutred in such manner that it allows for an easy integration with other software, such as Transkribus. <br>
19
-
20
- You can use our own developed Image viewer for the xml output:
21
- <p align="center">
22
- <a href="https://huggingface.co/spaces/Riksarkivet/Viewer_demo">
23
- <img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-xl-dark.svg" alt="Badge 1">
24
- </a>
25
- </p>
26
- <br>
27
-
28
-
29
- """
30
- reach_out = """ Feel free to reach out if you have any questions or need further assistance!
31
-
32
- """
33
-
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
-
46
- htr_tool_api_text = """
47
- ## Usage of Client API
48
-
49
- If you prefer to run **Fast track** programmatically, we offer an API for that purpose.
50
-
51
- - Docuemtnation for gradio client with [python](https://www.gradio.app/guides/getting-started-with-the-python-client)
52
- - Docuemtnation for gradio client with [javascript](https://www.gradio.app/guides/getting-started-with-the-js-client)
53
-
54
- **Note**: More extensive APIs and documentation can be added in the future upon request.
55
-
56
- See example below for usage of API in python:
57
-
58
- """
59
-
60
- stepwise_htr_tool_tab1 = """
61
- ### Tab 1: Region Segmentation
62
- The Region Segmentation tab allows you to perform the initial step of segmenting the handwritten text into regions of interest. By adjusting the P-threshold and C-threshold settings, you can control the confidence score required for a prediction and the minimum overlap or similarity for a detected region to be considered valid. Additionally, you can select an underlying machine learning model for region segmentation. <br>
63
- To perform region segmentation, follow these steps:
64
- 1. Open the "Region Segmentation" tab.
65
- 2. Upload an image or choose an image from the provided Examples (under "Example images to use:" accordin).
66
- 3. Configure the region segmentation settings:
67
- - Adjust the P-threshold: Filter and determine the confidence score required for a prediction score to be considered.
68
- - Adjust the C-threshold: Set the minimum required overlap or similarity for a detected region or object to be considered valid.
69
- - Select an underlying machine learning model.
70
- 4. Click the "Run Region Segmentation" button to initiate the region segmentation process.
71
- """
72
- stepwise_htr_tool_tab2 = """
73
-
74
- ### Tab 2: Line Segmentation
75
- In the Line Segmentation tab, you can further refine the segmentation process by identifying individual lines of text.
76
- Similar to the Region Segmentation tab, you can adjust the P-threshold and C-threshold settings for line segmentation and choose an appropriate machine learning model. <br>
77
- To perform line segmentation, follow these steps:
78
- 1. Open the "Line Segmentation" tab.
79
- 2. Choice a segmented region from image gallery, which populated with the results from the previous tab.
80
- 3. Configure the line segmentation settings:
81
- - Adjust the P-threshold: Filter and determine the confidence score required for a prediction score to be considered.
82
- - Adjust the C-threshold: Set the minimum required overlap or similarity for a detected region or object to be considered valid.
83
- - Select an underlying machine learning model.
84
- 4. Click the "Run Line Segmentation" button to initiate the line segmentation process.
85
- """
86
-
87
- stepwise_htr_tool_tab3 = """
88
- ### Tab 3: Transcribe Text
89
- The Transcribe Text tab allows you to convert the segmented text into transcriptions. Here, you can select the desired machine learning model for text transcription. <br>
90
- To transcribe text, follow these steps:
91
- 1. Open the "Transcribe Text" tab.
92
- 2. The image to transcribe is predefined with the results from the previous tab.
93
- 3. Configure the text transcription settings:
94
- - Select an underlying machine learning model.
95
- 4. Click the "Run Text Transcription" button to initiate the text transcription process.
96
- """
97
-
98
- stepwise_htr_tool_tab4 = """
99
- ### Tab 4: Explore Results
100
- Once the transcription is complete, you can explore the results in the Explore Results tab. This tab provides various features for analyzing and interacting with the transcriptions, allowing you to sort and identify both bad and good predictions. <br>
101
- To explore the HTR results, follow these steps:
102
- 1. Open the "Explore Results" tab.
103
- 2. Analyze the generated results. The image gallery of cropped text line segments is bi-directional coupled through interaction with the dataframe on the left.
104
- 3. Use the provided features, such as the prediction score to sort and interact with the image gallery, identifying both bad and good transcriptions.
105
- """
106
-
107
- stepwise_htr_tool_end = """
108
- As mentioned, please note that each tab in this workflow is dependent on the previous steps, where you progressively work through the process in a step-by-step manner.
109
- <br>
110
- """
111
-
112
- both_htr_tool_video = """
113
- ## &nbsp;
114
- Alternatively, you can watch the instructional video below, which provides a step-by-step walkthrough of the HTR Tool and some additional features.
115
- """
116
-
117
- figure_htr_api = """
118
- <figure>
119
- <img src="https://raw.githubusercontent.com/Borg93/htr_gradio_file_placeholder/main/notebook_api.png" alt="HTR_tool" style="width:98%; display: block; margin-left: auto; margin-right:auto;" >
120
- <figcaption style="text-align: center;"> <em> Figure - How to run API through a client in a notebook </em></figcaption>
121
- </figure>
122
- """
123
-
124
- figure_htr_hardware = """
125
-
126
- <figure>
127
- <img src="https://raw.githubusercontent.com/Borg93/htr_gradio_file_placeholder/main/hardware_example.png" alt="HTR_tool" style="width:75%; display: block; margin-left: auto; margin-right:auto;" >
128
- <figcaption style="text-align: center;"> <em> Figure - Choose a hardware that has atleast a GPU </em></figcaption>
129
- </figure>
130
- """
131
- duplicatin_space_htr_text = """
132
- ## Duplicating for own use
133
-
134
- Please be aware of certain limitations when using the application:
135
- - Primarily, this application is designed for demonstration purposes and is not intended for mass HTR.
136
- - Currently, the Swedish National Archives has constraints on sharing hardware, leading to a queue system for high demand.
137
- - The demo is hosted on Hugging Face domains, and they may rate-limit you if there's an excessive number of requests in a short timeframe, especially when using the API.
138
-
139
- For those requiring heavy usage, you can conveniently duplicate the application.
140
- - Duplicate [application](https://huggingface.co/spaces/Riksarkivet/htr_demo?duplicate=true).
141
-
142
- By doing so, you'll create your own private app, which allows for unlimited requests without any restrictions. The image below shows the minimum hardware you need to use if you don't have access to hardware youself:
143
-
144
- """
145
-
146
- duplicatin_for_privat = """
147
- For individuals with access to dedicated hardware, additional options are available. You have the flexibility to run this application on your own machine utilizing Docker, or by cloning the repository directly. Doing so allows you to leverage your hardware's capabilities to their fullest extent.
148
- - [Clone with Docker](https://huggingface.co/spaces/Riksarkivet/htr_demo?docker=true)
149
- - [Clone Repo](https://huggingface.co/spaces/Riksarkivet/htr_demo/settings?clone=true)
150
-
151
- **Note**: To take advantage of CUDA for accelerated inferences, an Nvidia graphics card is required. This setup significantly enhances the performance, ensuring a smoother and faster operation.
152
-
153
- """
154
-
155
- code_for_api = """
156
- from gradio_client import Client # pip install gradio_client
157
-
158
- # Change url to your client (localhost: http://127.0.0.1:7860/)
159
- client = Client("https://huggingface.co/spaces/Riksarkivet/htr_demo")
160
- job = client.submit(
161
- "https://your.image.url.or.pah.jpg",
162
- api_name="/predict",
163
- )
164
-
165
- print(job.result())
166
-
167
- """
168
- output_code_for_api_text = """
169
- ### Output from the api
170
-
171
- The output from the api is currently in the format of Page XML, which can be imported into this [viewer](https://huggingface.co/spaces/Riksarkivet/Viewer_demo).
172
-
173
-
174
- """
175
-
176
- output_code_for_api = """
177
-
178
-
179
- Loaded as API: http://127.0.0.1:7860/ βœ”
180
- <?xml version="1.0" encoding="UTF-8"?>
181
- <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">
182
- <Metadata>
183
- <Creator>Swedish National Archives</Creator>
184
- <Created>2023-08-21, 13:28:06</Created>
185
- </Metadata>
186
- <Page imageFilename="page_xml.xml" imageWidth="4885" imageHeight="4066">
187
- <TextRegion id="region_0" custom="readingOrder {index:0;}">
188
- <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"/>
189
- <TextLine id="line_region_0_0" custom="readingOrder {index:0;}">
190
- <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"/>
191
- <TextEquiv>
192
- <Unicode>Γ…r 1865.</Unicode>
193
- </TextEquiv>
194
- <PredScore pred_score="0.9482"/>
195
- </TextLine>
196
- </TextRegion>
197
- <TextRegion id="region_1" custom="readingOrder {index:1;}">
198
- ......................................
199
- </TextRegion>
200
- </Page>
201
- </PcGts>
202
-
203
- # Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
204
- """
205
-
206
- text_faq = read_markdown("helper/text/help/faq_discussion/faq.md")
207
-
208
- text_contact = """
209
-
210
- """
211
-
212
- text_discussion = read_markdown("helper/text/help/faq_discussion/discussion.md")
213
-
214
-
215
- if __name__ == "__main__":
216
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helper/text/text_overview.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from helper.text.markdown_reader import read_markdown
2
+
3
+
4
+ class TextOverview:
5
+ # HTRFLOW
6
+ htrflow_col1 = read_markdown("helper/text/overview/htrflow/htrflow_col1.md")
7
+ htrflow_col2 = read_markdown("helper/text/overview/htrflow/htrflow_col2.md")
8
+ htrflow_row1 = read_markdown("helper/text/overview/htrflow/htrflow_row1.md")
9
+ htrflow_tab1 = read_markdown("helper/text/overview/htrflow/htrflow_tab1.md")
10
+ htrflow_tab2 = read_markdown("helper/text/overview/htrflow/htrflow_tab2.md")
11
+ htrflow_tab3 = read_markdown("helper/text/overview/htrflow/htrflow_tab3.md")
12
+ htrflow_tab4 = read_markdown("helper/text/overview/htrflow/htrflow_tab4.md")
13
+
14
+ # faq & discussion
15
+ text_faq = read_markdown("helper/text/overview/faq_discussion/faq.md")
16
+ text_discussion = read_markdown("helper/text/overview/faq_discussion/discussion.md")
17
+
18
+ # Contributions
19
+ contributions = read_markdown("helper/text/overview/contributions/contributions.md")
20
+
21
+ # Changelog & Roadmap
22
+ changelog = read_markdown("helper/text/overview/changelog_roadmap/changelog.md")
23
+ roadmap = read_markdown("helper/text/overview/changelog_roadmap/roadmap.md")
24
+
25
+ # duplicate & api
26
+ duplicate = read_markdown("helper/text/overview/duplicate_api/duplicate.md")
27
+ api1 = read_markdown("helper/text/overview/duplicate_api/api1.md")
28
+ api_code1 = read_markdown("helper/text/overview/duplicate_api/api_code1.md")
29
+ api2 = read_markdown("helper/text/overview/duplicate_api/api2.md")
30
+ api_code2 = read_markdown("helper/text/overview/duplicate_api/api_code2.md")
31
+
32
+
33
+ if __name__ == "__main__":
34
+ pass
tabs/help_tab.py DELETED
@@ -1,42 +0,0 @@
1
- import gradio as gr
2
-
3
- from helper.text.text_help import TextHowTo
4
-
5
- with gr.Blocks() as help_tab:
6
- with gr.Tabs():
7
- with gr.Tab("Fast track"):
8
- gr.Markdown("WIP")
9
- pass
10
- with gr.Tab("Stepwise"):
11
- with gr.Row(equal_height=False):
12
- gr.Markdown(TextHowTo.stepwise_htr_tool)
13
- with gr.Row():
14
- gr.Markdown(TextHowTo.stepwise_htr_tool_tab_intro)
15
- with gr.Row():
16
- with gr.Tabs():
17
- with gr.Tab("1. Region Segmentation"):
18
- with gr.Row():
19
- with gr.Column():
20
- gr.Markdown(TextHowTo.stepwise_htr_tool_tab1)
21
- with gr.Column():
22
- gr.Markdown("image")
23
- with gr.Tab("2. Line Segmentation"):
24
- with gr.Row():
25
- with gr.Column():
26
- gr.Markdown(TextHowTo.stepwise_htr_tool_tab2)
27
- with gr.Column():
28
- gr.Markdown("image")
29
- with gr.Tab("3. Transcribe Text"):
30
- with gr.Row():
31
- with gr.Column():
32
- gr.Markdown(TextHowTo.stepwise_htr_tool_tab3)
33
- with gr.Column():
34
- gr.Markdown("image")
35
- with gr.Tab("4. Explore Results"):
36
- with gr.Row():
37
- with gr.Column():
38
- gr.Markdown(TextHowTo.stepwise_htr_tool_tab4)
39
- with gr.Column():
40
- gr.Markdown("image")
41
- with gr.Row():
42
- gr.Markdown(TextHowTo.stepwise_htr_tool_end)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tabs/htr_tool.py CHANGED
@@ -174,6 +174,7 @@ with gr.Blocks() as htr_tool_tab:
174
  )
175
 
176
  with gr.Column(visible=False) as model_compare_selector:
 
177
  with gr.Row():
178
  gr.Radio(
179
  choices=["Compare Page XML", "Compare different runs"],
 
174
  )
175
 
176
  with gr.Column(visible=False) as model_compare_selector:
177
+ gr.Markdown("**Work in progress:**")
178
  with gr.Row():
179
  gr.Radio(
180
  choices=["Compare Page XML", "Compare different runs"],
tabs/{about_tab.py β†’ overview_tab.py} RENAMED
@@ -1,71 +1,65 @@
1
  import gradio as gr
2
 
3
- from helper.text.text_about import TextAbout
4
- from helper.text.text_help import TextHowTo
5
 
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.htrflow_col1)
12
  with gr.Column():
13
- gr.Markdown(TextAbout.htrflow_col2)
14
  with gr.Row():
15
- gr.Markdown(TextAbout.htrflow_row1)
16
  with gr.Row():
17
  with gr.Tabs():
18
  with gr.Tab("Binarization"):
19
- gr.Markdown(TextAbout.htrflow_tab1)
20
  with gr.Tab("Region segmentation"):
21
- gr.Markdown(TextAbout.htrflow_tab2)
22
  with gr.Tab("Line segmentation"):
23
- gr.Markdown(TextAbout.htrflow_tab3)
24
  with gr.Tab("Text recognition"):
25
- gr.Markdown(TextAbout.htrflow_tab4)
26
 
27
  with gr.Tab("FAQ & Discussion"):
28
  with gr.Row():
29
  with gr.Column():
30
- gr.Markdown(TextHowTo.text_faq)
31
  with gr.Column():
32
- gr.Markdown(TextHowTo.text_discussion)
33
 
34
  with gr.Tab("Contributions"):
35
  with gr.Row():
36
- gr.Markdown(TextAbout.contributions)
37
-
38
- with gr.Tab("Changelog & Roadmap"):
39
- with gr.Row():
40
- with gr.Column():
41
- with gr.Accordion("Current Changelog", open=True):
42
- gr.Markdown(TextAbout.current_changelog)
43
- with gr.Accordion("Old Changelog", open=False):
44
- gr.Markdown(TextAbout.old_changelog)
45
- with gr.Column():
46
- gr.Markdown(TextAbout.roadmap)
47
 
48
  with gr.Tab("Duplicating for own use & API"):
49
  with gr.Row():
50
  with gr.Column():
51
- gr.Markdown(TextHowTo.duplicatin_space_htr_text)
52
- gr.Markdown(TextHowTo.figure_htr_hardware)
53
- gr.Markdown(TextHowTo.duplicatin_for_privat)
54
 
55
  with gr.Column():
56
- gr.Markdown(TextHowTo.htr_tool_api_text)
57
  gr.Code(
58
- value=TextHowTo.code_for_api,
59
  language="python",
60
  interactive=False,
61
  show_label=False,
62
  )
63
 
64
- gr.Markdown(TextHowTo.output_code_for_api_text)
65
 
66
  gr.Code(
67
- value=TextHowTo.output_code_for_api,
68
  language=None,
69
  interactive=False,
70
  show_label=False,
71
  )
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ from helper.text.text_overview import TextOverview
 
4
 
5
+ with gr.Blocks() as overview:
6
  with gr.Tabs():
7
  with gr.Tab("HTRFLOW"):
8
  with gr.Row():
9
  with gr.Column():
10
+ gr.Markdown(TextOverview.htrflow_col1)
11
  with gr.Column():
12
+ gr.Markdown(TextOverview.htrflow_col2)
13
  with gr.Row():
14
+ gr.Markdown(TextOverview.htrflow_row1)
15
  with gr.Row():
16
  with gr.Tabs():
17
  with gr.Tab("Binarization"):
18
+ gr.Markdown(TextOverview.htrflow_tab1)
19
  with gr.Tab("Region segmentation"):
20
+ gr.Markdown(TextOverview.htrflow_tab2)
21
  with gr.Tab("Line segmentation"):
22
+ gr.Markdown(TextOverview.htrflow_tab3)
23
  with gr.Tab("Text recognition"):
24
+ gr.Markdown(TextOverview.htrflow_tab4)
25
 
26
  with gr.Tab("FAQ & Discussion"):
27
  with gr.Row():
28
  with gr.Column():
29
+ gr.Markdown(TextOverview.text_faq)
30
  with gr.Column():
31
+ gr.Markdown(TextOverview.text_discussion)
32
 
33
  with gr.Tab("Contributions"):
34
  with gr.Row():
35
+ gr.Markdown(TextOverview.contributions)
 
 
 
 
 
 
 
 
 
 
36
 
37
  with gr.Tab("Duplicating for own use & API"):
38
  with gr.Row():
39
  with gr.Column():
40
+ gr.Markdown(TextOverview.duplicate)
 
 
41
 
42
  with gr.Column():
43
+ gr.Markdown(TextOverview.api1)
44
  gr.Code(
45
+ value=TextOverview.api_code1,
46
  language="python",
47
  interactive=False,
48
  show_label=False,
49
  )
50
 
51
+ gr.Markdown(TextOverview.api2)
52
 
53
  gr.Code(
54
+ value=TextOverview.api_code2,
55
  language=None,
56
  interactive=False,
57
  show_label=False,
58
  )
59
+
60
+ with gr.Tab("Changelog & Roadmap"):
61
+ with gr.Row():
62
+ with gr.Column():
63
+ gr.Markdown(TextOverview.changelog)
64
+ with gr.Column():
65
+ gr.Markdown(TextOverview.roadmap)