diff --git a/medcat-service/medcat_service/demo/demo_content.py b/medcat-service/medcat_service/demo/demo_content.py index 045f1ce2a..8344ddb46 100644 --- a/medcat-service/medcat_service/demo/demo_content.py +++ b/medcat-service/medcat_service/demo/demo_content.py @@ -4,13 +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') +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") 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