Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions medcat-service/medcat_service/demo/demo_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
6 changes: 3 additions & 3 deletions medcat-service/medcat_service/demo/gradio_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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]
)
Expand All @@ -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)
17 changes: 17 additions & 0 deletions medcat-service/medcat_service/demo/resources/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="https://github.com/CogStack/cogstack-nlp/blob/main/media/cat-logo.svg" />

<!-- Open Graph Meta Tags -->
<meta property="og:url" content="{url}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="MedCAT" />
<meta property="og:description" content="Click to see a demo of MedCAT" />
<meta property="og:image"
content="https://raw.githubusercontent.com/CogStack/cogstack-platform-toolkit/fb1a95db9c0139c751787fdb44dc0296b1db445f/docs/docs/assets/brand-logo-dark.svg" />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="MedCAT" />
<meta name="twitter:description" content="Click to see a demo of MedCAT" />
<meta name="twitter:image"
content="https://raw.githubusercontent.com/CogStack/cogstack-platform-toolkit/fb1a95db9c0139c751787fdb44dc0296b1db445f/docs/docs/assets/brand-logo-dark.svg" />
Loading