Spaces:
Sleeping
Sleeping
add image
Browse files- app.py +3 -36
- helper/text/text_howto.py +22 -0
- helper/text/text_roadmap.py +5 -0
app.py
CHANGED
@@ -60,15 +60,7 @@ with gr.Blocks(title="HTR Riksarkivet", theme=theme, css=css) as demo:
|
|
60 |
with gr.Tab("API"):
|
61 |
with gr.Row():
|
62 |
with gr.Column():
|
63 |
-
gr.Markdown(
|
64 |
-
"""
|
65 |
-
## Usage of Client API
|
66 |
-
|
67 |
-
For those interested in testing out the demo, it's available to run as a Gradio Python client.
|
68 |
-
To facilitate this, there's a lightweight package called gradio_client that you can easily install via pip.
|
69 |
-
"""
|
70 |
-
)
|
71 |
-
|
72 |
gr.Code(
|
73 |
value="""
|
74 |
from gradio_client import Client # pip install gradio_client
|
@@ -95,23 +87,7 @@ print(job.result())
|
|
95 |
gr.Markdown(TextHowTo.figure_htr_api)
|
96 |
|
97 |
with gr.Column():
|
98 |
-
gr.Markdown(
|
99 |
-
"""
|
100 |
-
## Duplicating a Space for private use
|
101 |
-
It's worth noting that while using any public 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.
|
102 |
-
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.
|
103 |
-
This private version allows you to make unlimited requests without any restrictions. So, if you're planning on heavy usage duplicate space:
|
104 |
-
|
105 |
-
<br>
|
106 |
-
<p align="center">
|
107 |
-
<a href="https://huggingface.co/spaces/Riksarkivet/htr_demo?duplicate=true">
|
108 |
-
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-xl-dark.svg" alt="Badge 1">
|
109 |
-
</a>
|
110 |
-
</p>
|
111 |
-
<br>
|
112 |
-
|
113 |
-
"""
|
114 |
-
)
|
115 |
gr.Markdown(TextHowTo.figure_htr_hardware)
|
116 |
|
117 |
gr.Markdown(
|
@@ -154,16 +130,7 @@ print(job.result())
|
|
154 |
with gr.Column():
|
155 |
gr.Markdown(TextRoadmap.roadmap)
|
156 |
with gr.Column():
|
157 |
-
gr.Markdown(TextRoadmap.
|
158 |
-
|
159 |
-
gr.Markdown(
|
160 |
-
"""
|
161 |
-
<p align="center">
|
162 |
-
<a href="https://huggingface.co/spaces/Riksarkivet/htr_demo/discussions">
|
163 |
-
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl-dark.svg" alt="Badge 1">
|
164 |
-
</a>
|
165 |
-
</p>"""
|
166 |
-
)
|
167 |
|
168 |
demo.load(None, None, None, _js=js)
|
169 |
|
|
|
60 |
with gr.Tab("API"):
|
61 |
with gr.Row():
|
62 |
with gr.Column():
|
63 |
+
gr.Markdown(TextHowTo.htr_tool_api_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
gr.Code(
|
65 |
value="""
|
66 |
from gradio_client import Client # pip install gradio_client
|
|
|
87 |
gr.Markdown(TextHowTo.figure_htr_api)
|
88 |
|
89 |
with gr.Column():
|
90 |
+
gr.Markdown(TextHowTo.duplicatin_space_htr_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
gr.Markdown(TextHowTo.figure_htr_hardware)
|
92 |
|
93 |
gr.Markdown(
|
|
|
130 |
with gr.Column():
|
131 |
gr.Markdown(TextRoadmap.roadmap)
|
132 |
with gr.Column():
|
133 |
+
gr.Markdown(TextRoadmap.discussion)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
demo.load(None, None, None, _js=js)
|
136 |
|
helper/text/text_howto.py
CHANGED
@@ -45,6 +45,13 @@ The Stepwise HTR Tool also provides a dedicated Explore Results tab, allowing yo
|
|
45 |
|
46 |
"""
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
stepwise_htr_tool_tab1 = """
|
49 |
### Tab 1: Region Segmentation
|
50 |
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.
|
@@ -119,6 +126,21 @@ Alternatively, you can watch the instructional video below, which provides a ste
|
|
119 |
<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;" >
|
120 |
<figcaption style="text-align: center;"> <em> Figure - Choose a hardware that has atleast a GPU </em></figcaption>
|
121 |
</figure>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
"""
|
123 |
|
124 |
|
|
|
45 |
|
46 |
"""
|
47 |
|
48 |
+
htr_tool_api_text = """
|
49 |
+
## Usage of Client API
|
50 |
+
|
51 |
+
For those interested in testing out the demo, it's available to run as a Gradio Python client.
|
52 |
+
To facilitate this, there's a lightweight package called gradio_client that you can easily install via pip.
|
53 |
+
"""
|
54 |
+
|
55 |
stepwise_htr_tool_tab1 = """
|
56 |
### Tab 1: Region Segmentation
|
57 |
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.
|
|
|
126 |
<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;" >
|
127 |
<figcaption style="text-align: center;"> <em> Figure - Choose a hardware that has atleast a GPU </em></figcaption>
|
128 |
</figure>
|
129 |
+
"""
|
130 |
+
duplicatin_space_htr_text = """
|
131 |
+
## Duplicating a Space for private use
|
132 |
+
It's worth noting that while using any public 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.
|
133 |
+
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.
|
134 |
+
This private version allows you to make unlimited requests without any restrictions. So, if you're planning on heavy usage duplicate space:
|
135 |
+
|
136 |
+
<br>
|
137 |
+
<p align="center">
|
138 |
+
<a href="https://huggingface.co/spaces/Riksarkivet/htr_demo?duplicate=true">
|
139 |
+
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-xl-dark.svg" alt="Badge 1">
|
140 |
+
</a>
|
141 |
+
</p>
|
142 |
+
<br>
|
143 |
+
|
144 |
"""
|
145 |
|
146 |
|
helper/text/text_roadmap.py
CHANGED
@@ -22,6 +22,11 @@ class TextRoadmap:
|
|
22 |
</a>
|
23 |
</p>"""
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
if __name__ == "__main__":
|
27 |
pass
|
|
|
22 |
</a>
|
23 |
</p>"""
|
24 |
|
25 |
+
roadmap_image = """
|
26 |
+
<p align="center">
|
27 |
+
<img src="" alt="Badge 1">
|
28 |
+
</p>"""
|
29 |
+
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
pass
|