Spaces:
Running
on
Zero
Running
on
Zero
carpelan
commited on
Commit
·
c9d685b
1
Parent(s):
1e41501
minor fixes in docs and sidebar
Browse files- .github/README.md +6 -0
- Dockerfile +1 -1
- app/content/sidebar.md +18 -9
- app/main.py +4 -1
- app/tabs/submit.py +3 -2
.github/README.md
CHANGED
@@ -109,6 +109,12 @@ Then open your web browser and navigate to `http://localhost:7860` (or the addre
|
|
109 |
|
110 |
## Running with Docker
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
### Locally with Docker
|
113 |
|
114 |
1. **Build the Docker Image:**
|
|
|
109 |
|
110 |
## Running with Docker
|
111 |
|
112 |
+
Please remove this line in dockerfile, when running locally:
|
113 |
+
```sh
|
114 |
+
ENV PYTHONUNBUFFERED=1 \
|
115 |
+
SYSTEM=spaces \
|
116 |
+
```
|
117 |
+
|
118 |
### Locally with Docker
|
119 |
|
120 |
1. **Build the Docker Image:**
|
Dockerfile
CHANGED
@@ -9,7 +9,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|
9 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
10 |
GRADIO_THEME=huggingface \
|
11 |
GRADIO_CACHE_DIR=/home/appuser/.gradio_cache \
|
12 |
-
SYSTEM=spaces \
|
13 |
AM_I_IN_A_DOCKER_CONTAINER=Yes \
|
14 |
PYTHONPATH=/home/appuser/app \
|
15 |
HF_HOME=/home/appuser/.cache \
|
|
|
9 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
10 |
GRADIO_THEME=huggingface \
|
11 |
GRADIO_CACHE_DIR=/home/appuser/.gradio_cache \
|
12 |
+
SYSTEM=spaces \
|
13 |
AM_I_IN_A_DOCKER_CONTAINER=Yes \
|
14 |
PYTHONPATH=/home/appuser/app \
|
15 |
HF_HOME=/home/appuser/.cache \
|
app/content/sidebar.md
CHANGED
@@ -1,15 +1,24 @@
|
|
1 |
-
## HTRflow Demo
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
|
|
9 |
|
10 |
-
|
11 |
-
2. **Results** – View the transcribed text generated by HTRflow.
|
12 |
-
3. **Export** – Select your preferred format and download the results.
|
13 |
|
14 |
-
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## HTRflow Demo
|
2 |
|
3 |
+
Welcome to the **HTRflow Demo** – a web application developed by the **National Archives of Sweden** in collaboration with [Huminfra](https://www.huminfra.se/). This demo lets you explore how AI transforms historical manuscripts into digital text using[HTRflow](https://ai-riksarkivet.github.io/htrflow/latest).
|
4 |
|
5 |
+
### How It Works
|
6 |
|
7 |
+
1. **Upload:** Submit your own image to run through HTRflow.
|
8 |
+
2. **Results:** View the transcribed text generated by the system.
|
9 |
+
3. **Export:** Choose your preferred format and download your results.
|
10 |
|
11 |
+
> Note: This demo application is for demonstration purposes only and is not intended for production use.
|
|
|
|
|
12 |
|
13 |
+
### Contact
|
14 |
|
15 |
+
✉️ [[email protected]](mailto:[email protected])
|
16 |
+
|
17 |
+
### Projects
|
18 |
+
|
19 |
+
Both the App and HTRflow's code are completely open source. Explore and contribute on GitHub:
|
20 |
+
|
21 |
+
- [APP](https://github.com/AI-Riksarkivet/htrflow_app).
|
22 |
+
- [HTRflow](https://ai-riksarkivet.github.io/htrflow/latest).
|
23 |
+
|
24 |
+
If you find our projects useful, please consider giving us a star ⭐!
|
app/main.py
CHANGED
@@ -57,11 +57,14 @@ matomo = """
|
|
57 |
<!-- End Matomo Code -->
|
58 |
"""
|
59 |
|
|
|
|
|
|
|
60 |
with gr.Blocks(
|
61 |
title="HTRflow",
|
62 |
theme=theme,
|
63 |
css=css,
|
64 |
-
head=
|
65 |
) as demo:
|
66 |
|
67 |
gr.Markdown(load_markdown(None, "main_title"))
|
|
|
57 |
<!-- End Matomo Code -->
|
58 |
"""
|
59 |
|
60 |
+
system_env = os.getenv("SYSTEM", "local")
|
61 |
+
head_content = matomo if system_env == "spaces" else None
|
62 |
+
|
63 |
with gr.Blocks(
|
64 |
title="HTRflow",
|
65 |
theme=theme,
|
66 |
css=css,
|
67 |
+
head=head_content,
|
68 |
) as demo:
|
69 |
|
70 |
gr.Markdown(load_markdown(None, "main_title"))
|
app/tabs/submit.py
CHANGED
@@ -9,7 +9,6 @@ from htrflow.pipeline.pipeline import Pipeline
|
|
9 |
from htrflow.pipeline.steps import init_step
|
10 |
from htrflow.volume.volume import Collection
|
11 |
|
12 |
-
from app.main import load_markdown
|
13 |
from app.pipelines import PIPELINES
|
14 |
|
15 |
logger = logging.getLogger(__name__)
|
@@ -289,7 +288,7 @@ with gr.Blocks() as submit:
|
|
289 |
|
290 |
image_iiif_url.submit(
|
291 |
fn=return_iiif_url, inputs=image_iiif_url, outputs=batch_image_gallery
|
292 |
-
)
|
293 |
|
294 |
run_button.click(
|
295 |
fn=run_htrflow,
|
@@ -301,3 +300,5 @@ with gr.Blocks() as submit:
|
|
301 |
examples.select(get_selected_example_pipeline, None, pipeline_dropdown)
|
302 |
|
303 |
edit_pipeline_button.click(lambda: Modal(visible=True), None, edit_pipeline_modal)
|
|
|
|
|
|
9 |
from htrflow.pipeline.steps import init_step
|
10 |
from htrflow.volume.volume import Collection
|
11 |
|
|
|
12 |
from app.pipelines import PIPELINES
|
13 |
|
14 |
logger = logging.getLogger(__name__)
|
|
|
288 |
|
289 |
image_iiif_url.submit(
|
290 |
fn=return_iiif_url, inputs=image_iiif_url, outputs=batch_image_gallery
|
291 |
+
).then(fn=lambda: "Swedish - Spreads", outputs=pipeline_dropdown)
|
292 |
|
293 |
run_button.click(
|
294 |
fn=run_htrflow,
|
|
|
300 |
examples.select(get_selected_example_pipeline, None, pipeline_dropdown)
|
301 |
|
302 |
edit_pipeline_button.click(lambda: Modal(visible=True), None, edit_pipeline_modal)
|
303 |
+
|
304 |
+
# TODO: submit on image_id .. --> yaml swedish - spreads
|