Spaces:
Runtime error
Runtime error
Update app.py (#4)
Browse files- Update app.py (71631098744a0787ab6e475be7c9bcff65872591)
Co-authored-by: Umar <umar-ts@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from service import GPT_Service, Stage
|
|
| 3 |
|
| 4 |
|
| 5 |
title_html = """
|
| 6 |
-
<div style="display: flex; align-items: center; width=100%; background-color:#FFC90E;">
|
| 7 |
<img src='https://i.ibb.co/gPFskvg/LOGO-1.png' style='height: 90px; width:90px; margin-left: 20px;'>
|
| 8 |
<span style="margin-left: 20px;font-size:30px">
|
| 9 |
<span>Patient Assessment Documentation</span>
|
|
@@ -16,6 +16,7 @@ css = """
|
|
| 16 |
#subButton, #rephraseBtn {
|
| 17 |
background-color: #EA580C !important;
|
| 18 |
background: #EA580C !important;
|
|
|
|
| 19 |
border: none !important; /* Remove the border */
|
| 20 |
transition: background-color 0.3s ease; /* Add transition for smoother hover effect */
|
| 21 |
}
|
|
@@ -67,6 +68,9 @@ def select_handler(prevResponse, newResponse):
|
|
| 67 |
return f"{prevResponse + (' ' if prevResponse.strip() != '' else '')} {newResponse}"
|
| 68 |
else:
|
| 69 |
return prevResponse
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
|
| 72 |
def getRephrasedSentences(sentences):
|
|
@@ -94,46 +98,49 @@ with gr.Blocks(css=css) as demo:
|
|
| 94 |
clearInputFields = gr.ClearButton(value="Clear Inputs",components=[keywords,medicalHistory,stage])
|
| 95 |
responseButton = gr.Button("Submit",elem_id="subButton")
|
| 96 |
|
| 97 |
-
gr.HTML("<h2 style=\"margin-top:10\">Suggested Assessment Documentation</h2>")
|
| 98 |
-
with gr.Column():
|
| 99 |
-
label1 = gr.Markdown(value="Keyword 1",show_label=False)
|
| 100 |
-
with gr.Row() as firstKeywordResponses:
|
| 101 |
-
firstKeywordResponseUtterance1 = gr.Textbox(label="Variant 1",interactive=False, show_copy_button=True)
|
| 102 |
-
firstKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 103 |
-
firstKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 104 |
-
|
| 105 |
-
label2 = gr.Markdown(value="Keyword 2",show_label=False)
|
| 106 |
-
with gr.Row() as secondKeywordResponses:
|
| 107 |
-
secondKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 108 |
-
secondKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 109 |
-
secondKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 110 |
-
|
| 111 |
-
label3 = gr.Markdown(value="Keyword 3",show_label=False)
|
| 112 |
-
with gr.Row() as thirdKeywordResponses:
|
| 113 |
-
thirdKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 114 |
-
thirdKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 115 |
-
thirdKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 116 |
-
|
| 117 |
-
label4 = gr.Markdown(value="Keyword 4",show_label=False)
|
| 118 |
-
with gr.Row() as fourthKeywordResponses:
|
| 119 |
-
fourthKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 120 |
-
fourthKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 121 |
-
fourthKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 122 |
-
|
| 123 |
-
label5 = gr.Markdown(value="Keyword 5",show_label=False)
|
| 124 |
-
with gr.Row() as fifthKeywordResponses:
|
| 125 |
-
fifthKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 126 |
-
fifthKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 127 |
-
fifthKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 128 |
-
|
| 129 |
-
gr.HTML("<h2>Documentation Generator</h2>")
|
| 130 |
with gr.Row():
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
# First response event listeners
|
|
@@ -167,6 +174,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 167 |
label4,fourthKeywordResponseUtterance1,fourthKeywordResponseUtterance2,fourthKeywordResponseUtterance3,
|
| 168 |
label5,fifthKeywordResponseUtterance1,fifthKeywordResponseUtterance2,fifthKeywordResponseUtterance3])
|
| 169 |
rephraseButton.click(getRephrasedSentences,selectedSentence,rephrasedSentence)
|
|
|
|
| 170 |
|
| 171 |
|
| 172 |
-
demo.launch()
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
title_html = """
|
| 6 |
+
<div style="display: flex; align-items: center; width=100%; background-color:#FFC90E; border-radius:10px;">
|
| 7 |
<img src='https://i.ibb.co/gPFskvg/LOGO-1.png' style='height: 90px; width:90px; margin-left: 20px;'>
|
| 8 |
<span style="margin-left: 20px;font-size:30px">
|
| 9 |
<span>Patient Assessment Documentation</span>
|
|
|
|
| 16 |
#subButton, #rephraseBtn {
|
| 17 |
background-color: #EA580C !important;
|
| 18 |
background: #EA580C !important;
|
| 19 |
+
color:'#FFFFFF'
|
| 20 |
border: none !important; /* Remove the border */
|
| 21 |
transition: background-color 0.3s ease; /* Add transition for smoother hover effect */
|
| 22 |
}
|
|
|
|
| 68 |
return f"{prevResponse + (' ' if prevResponse.strip() != '' else '')} {newResponse}"
|
| 69 |
else:
|
| 70 |
return prevResponse
|
| 71 |
+
|
| 72 |
+
def clear_input(response):
|
| 73 |
+
return ""
|
| 74 |
|
| 75 |
|
| 76 |
def getRephrasedSentences(sentences):
|
|
|
|
| 98 |
clearInputFields = gr.ClearButton(value="Clear Inputs",components=[keywords,medicalHistory,stage])
|
| 99 |
responseButton = gr.Button("Submit",elem_id="subButton")
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
with gr.Row():
|
| 102 |
+
with gr.Column(scale=2):
|
| 103 |
+
gr.HTML("<h2>Suggested Assessment Documentation</h2>")
|
| 104 |
+
label1 = gr.Markdown(value="Keyword 1",show_label=False)
|
| 105 |
+
with gr.Row() as firstKeywordResponses:
|
| 106 |
+
firstKeywordResponseUtterance1 = gr.Textbox(label="Variant 1",interactive=False, show_copy_button=True)
|
| 107 |
+
firstKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 108 |
+
firstKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 109 |
+
|
| 110 |
+
label2 = gr.Markdown(value="Keyword 2",show_label=False)
|
| 111 |
+
with gr.Row() as secondKeywordResponses:
|
| 112 |
+
secondKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 113 |
+
secondKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 114 |
+
secondKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 115 |
+
|
| 116 |
+
label3 = gr.Markdown(value="Keyword 3",show_label=False)
|
| 117 |
+
with gr.Row() as thirdKeywordResponses:
|
| 118 |
+
thirdKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 119 |
+
thirdKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 120 |
+
thirdKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 121 |
+
|
| 122 |
+
label4 = gr.Markdown(value="Keyword 4",show_label=False)
|
| 123 |
+
with gr.Row() as fourthKeywordResponses:
|
| 124 |
+
fourthKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 125 |
+
fourthKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 126 |
+
fourthKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 127 |
+
|
| 128 |
+
label5 = gr.Markdown(value="Keyword 5",show_label=False)
|
| 129 |
+
with gr.Row() as fifthKeywordResponses:
|
| 130 |
+
fifthKeywordResponseUtterance1 = gr.Textbox(label="Variant 1", interactive=False, show_copy_button=True)
|
| 131 |
+
fifthKeywordResponseUtterance2 = gr.Textbox(label="Variant 2", interactive=False, show_copy_button=True)
|
| 132 |
+
fifthKeywordResponseUtterance3 = gr.Textbox(label="Variant 3", interactive=False, show_copy_button=True)
|
| 133 |
+
|
| 134 |
+
with gr.Column(scale=1):
|
| 135 |
+
gr.HTML("<h2>Documentation Generator</h2>")
|
| 136 |
+
with gr.Row():
|
| 137 |
+
with gr.Column():
|
| 138 |
+
selectedSentence=gr.Textbox(label="Selected Sentences", show_copy_button=True,lines=15)
|
| 139 |
+
with gr.Row():
|
| 140 |
+
clearSelectedSentences= gr.Button("Clear")
|
| 141 |
+
rephraseButton = gr.Button("Generate Documentation",elem_id="rephraseBtn",)
|
| 142 |
+
|
| 143 |
+
rephrasedSentence=gr.Textbox(label="Patient Visit Documentation", interactive=False, show_copy_button=True,lines=15)
|
| 144 |
|
| 145 |
|
| 146 |
# First response event listeners
|
|
|
|
| 174 |
label4,fourthKeywordResponseUtterance1,fourthKeywordResponseUtterance2,fourthKeywordResponseUtterance3,
|
| 175 |
label5,fifthKeywordResponseUtterance1,fifthKeywordResponseUtterance2,fifthKeywordResponseUtterance3])
|
| 176 |
rephraseButton.click(getRephrasedSentences,selectedSentence,rephrasedSentence)
|
| 177 |
+
clearSelectedSentences.click(clear_input,selectedSentence,selectedSentence)
|
| 178 |
|
| 179 |
|
| 180 |
+
demo.launch()
|