Commit
·
356a864
1
Parent(s):
2c63b1a
Fix Page Text
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
#########################################################################
|
| 2 |
# Copyright (C) #
|
| 3 |
-
# 2025-
|
| 4 |
# Permission given to modify the code only for Non-Profit Research #
|
| 5 |
# as long as you keep this declaration at the top #
|
| 6 |
#########################################################################
|
|
@@ -59,7 +59,7 @@ def func_sBERT_SimilarityResult(str_Text_1, str_Text_2):
|
|
| 59 |
tensor_Similarity = sentence_transformers.util.pytorch_cos_sim(arrEmbedding_Text_1, arrEmbedding_Text_2)
|
| 60 |
f_Similarity = tensor_Similarity.item()
|
| 61 |
|
| 62 |
-
return f"
|
| 63 |
|
| 64 |
# ----------------------------------------------------------------------------------------------------------------------
|
| 65 |
# Launch the interface and MCP server
|
|
@@ -72,7 +72,7 @@ if __name__ == "__main__":
|
|
| 72 |
# 03. Gradio UI elements
|
| 73 |
with gr.Blocks() as grBlocks_SentenceSimilarity__MCP_Server:
|
| 74 |
gr.Markdown("# ClinicalBERT for Clinical Text Similarity using HF Inference Server")
|
| 75 |
-
gr.Markdown("This application calculates Similarity Score between two Texts")
|
| 76 |
|
| 77 |
with gr.Row():
|
| 78 |
grTextBox_Input_1 = gr.Textbox(label="Text Panel 1", lines=20)
|
|
|
|
| 1 |
#########################################################################
|
| 2 |
# Copyright (C) #
|
| 3 |
+
# 2025-August Sen Li (Sen.Li.Sprout@gmail.com) #
|
| 4 |
# Permission given to modify the code only for Non-Profit Research #
|
| 5 |
# as long as you keep this declaration at the top #
|
| 6 |
#########################################################################
|
|
|
|
| 59 |
tensor_Similarity = sentence_transformers.util.pytorch_cos_sim(arrEmbedding_Text_1, arrEmbedding_Text_2)
|
| 60 |
f_Similarity = tensor_Similarity.item()
|
| 61 |
|
| 62 |
+
return f"Clinical Similarity Score: {f_Similarity:.4f}"
|
| 63 |
|
| 64 |
# ----------------------------------------------------------------------------------------------------------------------
|
| 65 |
# Launch the interface and MCP server
|
|
|
|
| 72 |
# 03. Gradio UI elements
|
| 73 |
with gr.Blocks() as grBlocks_SentenceSimilarity__MCP_Server:
|
| 74 |
gr.Markdown("# ClinicalBERT for Clinical Text Similarity using HF Inference Server")
|
| 75 |
+
gr.Markdown("This application calculates Cosine Similarity Score between two Texts' ClinicalBERT Sentence-Embeddings")
|
| 76 |
|
| 77 |
with gr.Row():
|
| 78 |
grTextBox_Input_1 = gr.Textbox(label="Text Panel 1", lines=20)
|