From ac176112ce502a13b134c332bfe7f8d88c01d4ec Mon Sep 17 00:00:00 2001
From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.>
Date: Thu, 12 Mar 2026 10:34:34 +0000
Subject: [PATCH 1/2] feat(medcat-service): Setup unfurl preview for medcat
demo apps
---
.../medcat_service/demo/demo_content.py | 1 +
.../medcat_service/demo/gradio_demo.py | 6 +++---
.../medcat_service/demo/resources/head.html | 17 +++++++++++++++++
3 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 medcat-service/medcat_service/demo/resources/head.html
diff --git a/medcat-service/medcat_service/demo/demo_content.py b/medcat-service/medcat_service/demo/demo_content.py
index 045f1ce2a..40d9d8ca0 100644
--- a/medcat-service/medcat_service/demo/demo_content.py
+++ b/medcat-service/medcat_service/demo/demo_content.py
@@ -14,3 +14,4 @@ def _read_file(filename: str) -> str:
anoncat_example = _read_file('anoncat_example.txt')
article_footer = _read_file('article_footer.txt')
anoncat_help_content = _read_file('anoncat_help_content.txt')
+head = _read_file('head.html')
\ No newline at end of file
diff --git a/medcat-service/medcat_service/demo/gradio_demo.py b/medcat-service/medcat_service/demo/gradio_demo.py
index 5daefdf55..29fe9380c 100644
--- a/medcat-service/medcat_service/demo/gradio_demo.py
+++ b/medcat-service/medcat_service/demo/gradio_demo.py
@@ -126,7 +126,7 @@ def output_column():
inputs=[input_text, redact],
outputs=[highlighted, dataframe, deidentified_text],
)
- annotate_btn.click(lambda: (annotation_details_placeholder_text), outputs=[annotation_details])
+ annotate_btn.click(lambda: annotation_details_placeholder_text, outputs=[annotation_details])
clear_btn.click(
lambda: ("", None, None, annotation_details_placeholder_text),
@@ -162,7 +162,7 @@ def input_column():
with gr.Column():
highlighted, annotation_details, dataframe = output_details_interface()
- annotate_btn.click(lambda: (annotation_details_placeholder_text), outputs=[annotation_details])
+ annotate_btn.click(lambda: annotation_details_placeholder_text, outputs=[annotation_details])
annotate_btn.click(
medcat_demo_perform_named_entity_resolution, inputs=input_text, outputs=[highlighted, dataframe]
)
@@ -187,4 +187,4 @@ def mount_gradio_app(app: FastAPI, path: str) -> None:
io = anoncat_demo_interface() if settings.deid_mode else medcat_demo_interface()
- gr.mount_gradio_app(app, io, path=path, theme=theme, css=highlighted_text_css)
+ gr.mount_gradio_app(app, io, path=path, theme=theme, css=highlighted_text_css, head=demo_content.head)
diff --git a/medcat-service/medcat_service/demo/resources/head.html b/medcat-service/medcat_service/demo/resources/head.html
new file mode 100644
index 000000000..be839e01f
--- /dev/null
+++ b/medcat-service/medcat_service/demo/resources/head.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 8711854685a43c44dad8709df67ad729af978830 Mon Sep 17 00:00:00 2001
From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.>
Date: Thu, 12 Mar 2026 10:42:27 +0000
Subject: [PATCH 2/2] feat(medcat-service): Setup unfurl preview for medcat
demo apps - format
---
.../medcat_service/demo/demo_content.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/medcat-service/medcat_service/demo/demo_content.py b/medcat-service/medcat_service/demo/demo_content.py
index 40d9d8ca0..8344ddb46 100644
--- a/medcat-service/medcat_service/demo/demo_content.py
+++ b/medcat-service/medcat_service/demo/demo_content.py
@@ -4,14 +4,14 @@
@cache
def _read_file(filename: str) -> str:
- package = importlib.resources.files(__package__ or 'medcat_service.demo')
- file_path = package / 'resources' / filename
- return file_path.read_text(encoding='utf-8')
+ package = importlib.resources.files(__package__ or "medcat_service.demo")
+ file_path = package / "resources" / filename
+ return file_path.read_text(encoding="utf-8")
-short_example = _read_file('short_example.txt')
-long_example = _read_file('long_example.txt')
-anoncat_example = _read_file('anoncat_example.txt')
-article_footer = _read_file('article_footer.txt')
-anoncat_help_content = _read_file('anoncat_help_content.txt')
-head = _read_file('head.html')
\ No newline at end of file
+short_example = _read_file("short_example.txt")
+long_example = _read_file("long_example.txt")
+anoncat_example = _read_file("anoncat_example.txt")
+article_footer = _read_file("article_footer.txt")
+anoncat_help_content = _read_file("anoncat_help_content.txt")
+head = _read_file("head.html")