Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,100 +19,124 @@ with open("offer.html", "r", encoding="utf-8") as f:
|
|
| 19 |
with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
|
| 20 |
flow_chart = f.read()
|
| 21 |
|
| 22 |
-
#
|
| 23 |
# css = """
|
|
|
|
| 24 |
# #nps-buttons-container .gr-radio-group {
|
| 25 |
# display: flex;
|
| 26 |
-
# flex-direction: row;
|
| 27 |
-
# justify-content: center;
|
| 28 |
-
# gap:
|
| 29 |
-
#
|
| 30 |
-
# #nps-buttons-container .gr-radio-input {
|
| 31 |
-
# display: none; /* Hide the default radio circle */
|
| 32 |
# }
|
|
|
|
|
|
|
| 33 |
# #nps-buttons-container .gr-radio-label {
|
| 34 |
# display: flex;
|
| 35 |
# justify-content: center;
|
| 36 |
# align-items: center;
|
| 37 |
-
# width:
|
| 38 |
-
# height:
|
| 39 |
-
# border-radius:
|
| 40 |
-
# background-color: #38a169;
|
| 41 |
# color: white;
|
| 42 |
# font-weight: bold;
|
| 43 |
# cursor: pointer;
|
| 44 |
# transition: background-color 0.2s ease;
|
|
|
|
| 45 |
# }
|
|
|
|
|
|
|
| 46 |
# #nps-buttons-container .gr-radio-label:hover {
|
| 47 |
-
# background-color: #2f855a;
|
| 48 |
# }
|
| 49 |
# #nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
| 50 |
-
# background-color: #1a4f35;
|
| 51 |
-
# border: 2px solid white;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
# }
|
| 53 |
-
# #nps-
|
| 54 |
-
#
|
| 55 |
# font-size: 0.9em;
|
| 56 |
# color: #666;
|
| 57 |
# }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# """
|
| 59 |
-
|
| 60 |
css = """
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
#nps-buttons-container .gr-radio-group {
|
| 63 |
display: flex;
|
| 64 |
-
flex-direction: row;
|
| 65 |
-
justify-content:
|
| 66 |
-
gap: 5px;
|
| 67 |
-
flex-wrap: nowrap;
|
| 68 |
}
|
| 69 |
|
| 70 |
-
/* Styling for each individual button */
|
| 71 |
#nps-buttons-container .gr-radio-label {
|
| 72 |
display: flex;
|
| 73 |
justify-content: center;
|
| 74 |
align-items: center;
|
| 75 |
-
width: 35px;
|
| 76 |
-
height: 35px;
|
| 77 |
-
border-radius: 4px;
|
| 78 |
-
background-color: #
|
| 79 |
color: white;
|
| 80 |
font-weight: bold;
|
| 81 |
cursor: pointer;
|
| 82 |
transition: background-color 0.2s ease;
|
| 83 |
-
font-size: 14px;
|
| 84 |
}
|
| 85 |
|
| 86 |
-
/* Hover and selected states */
|
| 87 |
#nps-buttons-container .gr-radio-label:hover {
|
| 88 |
-
background-color: #
|
| 89 |
}
|
|
|
|
| 90 |
#nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
| 91 |
-
background-color: #
|
| 92 |
border: 2px solid white;
|
| 93 |
}
|
| 94 |
|
| 95 |
-
/* Hides the default radio button */
|
| 96 |
#nps-buttons-container .gr-radio-input {
|
| 97 |
display: none;
|
| 98 |
}
|
| 99 |
|
| 100 |
-
/* Adjusting the text labels for "Not likely" and "Extremely likely" */
|
| 101 |
#nps-labels-row {
|
| 102 |
display: flex;
|
| 103 |
justify-content: space-between;
|
| 104 |
-
margin-top:
|
|
|
|
| 105 |
}
|
|
|
|
| 106 |
#nps-labels-row p {
|
| 107 |
margin: 0;
|
| 108 |
-
font-size:
|
| 109 |
-
color: #666;
|
| 110 |
}
|
| 111 |
|
| 112 |
-
/* Styling for the submit button */
|
| 113 |
#nps-submit-button {
|
| 114 |
-
margin-top:
|
| 115 |
-
width: 100%;
|
| 116 |
}
|
| 117 |
"""
|
| 118 |
|
|
@@ -178,36 +202,22 @@ with gr.Blocks() as interface:
|
|
| 178 |
#output_type = gr.Dropdown(choices=["Excel", "JSON", "TXT"], label="Select Output Format", value="Excel")
|
| 179 |
#download_button = gr.Button("⬇️ Download Output")
|
| 180 |
#download_file = gr.File(label="Download File Here",visible=False)
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
|
|
|
| 184 |
label="Describe the issue",
|
| 185 |
lines=4,
|
| 186 |
placeholder="e.g. DQ981467: it gives me unknown when I can in fact search it on NCBI \n DQ981467: cannot find the result in batch output when the live processing did show already processed",
|
| 187 |
visible=False)
|
| 188 |
-
|
| 189 |
-
|
| 190 |
|
| 191 |
-
|
| 192 |
-
with gr.Column(elem_id="nps-box"):
|
|
|
|
| 193 |
gr.Markdown("### How likely are you to recommend this tool to a colleague or peer?")
|
| 194 |
# # Use gr.Radio to create clickable buttons
|
| 195 |
-
# nps_radio = gr.Radio(
|
| 196 |
-
# choices=[str(i) for i in range(11)], # Choices from 0 to 10
|
| 197 |
-
# label="Select score:",
|
| 198 |
-
# interactive=True,
|
| 199 |
-
# container=False, # Set to False to remove the default container
|
| 200 |
-
# elem_id="nps-buttons-container" # Use an elem_id for custom styling
|
| 201 |
-
# )
|
| 202 |
-
|
| 203 |
-
# # Use a Markdown component for the "Not likely" and "Extremely likely" labels
|
| 204 |
-
# with gr.Row():
|
| 205 |
-
# gr.Markdown("<p style='text-align: left; margin: 0;'>Not likely</p>", elem_id="nps-left-label")
|
| 206 |
-
# gr.Markdown("<p style='text-align: right; margin: 0;'>Extremely likely</p>", elem_id="nps-right-label")
|
| 207 |
-
|
| 208 |
-
# nps_submit = gr.Button("Submit")
|
| 209 |
-
# nps_output = gr.Textbox(label="", interactive=False, visible=True)
|
| 210 |
-
# The radio buttons container
|
| 211 |
with gr.Column(elem_id="nps-buttons-container"):
|
| 212 |
nps_radio = gr.Radio(
|
| 213 |
choices=[str(i) for i in range(11)],
|
|
|
|
| 19 |
with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
|
| 20 |
flow_chart = f.read()
|
| 21 |
|
| 22 |
+
# Define the CSS to control layout and styling
|
| 23 |
# css = """
|
| 24 |
+
# /* The main container for the buttons */
|
| 25 |
# #nps-buttons-container .gr-radio-group {
|
| 26 |
# display: flex;
|
| 27 |
+
# flex-direction: row; /* Arranges items in a horizontal line */
|
| 28 |
+
# justify-content: center; /* Centers the buttons horizontally */
|
| 29 |
+
# gap: 5px; /* Adjusts the space between buttons */
|
| 30 |
+
# flex-wrap: nowrap; /* Prevents buttons from wrapping to the next line */
|
|
|
|
|
|
|
| 31 |
# }
|
| 32 |
+
|
| 33 |
+
# /* Styling for each individual button */
|
| 34 |
# #nps-buttons-container .gr-radio-label {
|
| 35 |
# display: flex;
|
| 36 |
# justify-content: center;
|
| 37 |
# align-items: center;
|
| 38 |
+
# width: 35px; /* Fixed width for each button */
|
| 39 |
+
# height: 35px; /* Fixed height for each button */
|
| 40 |
+
# border-radius: 4px; /* Slightly rounded corners */
|
| 41 |
+
# background-color: #38a169;
|
| 42 |
# color: white;
|
| 43 |
# font-weight: bold;
|
| 44 |
# cursor: pointer;
|
| 45 |
# transition: background-color 0.2s ease;
|
| 46 |
+
# font-size: 14px; /* Adjust font size to fit smaller boxes */
|
| 47 |
# }
|
| 48 |
+
|
| 49 |
+
# /* Hover and selected states */
|
| 50 |
# #nps-buttons-container .gr-radio-label:hover {
|
| 51 |
+
# background-color: #2f855a;
|
| 52 |
# }
|
| 53 |
# #nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
| 54 |
+
# background-color: #1a4f35;
|
| 55 |
+
# border: 2px solid white;
|
| 56 |
+
# }
|
| 57 |
+
|
| 58 |
+
# /* Hides the default radio button */
|
| 59 |
+
# #nps-buttons-container .gr-radio-input {
|
| 60 |
+
# display: none;
|
| 61 |
+
# }
|
| 62 |
+
|
| 63 |
+
# /* Adjusting the text labels for "Not likely" and "Extremely likely" */
|
| 64 |
+
# #nps-labels-row {
|
| 65 |
+
# display: flex;
|
| 66 |
+
# justify-content: space-between;
|
| 67 |
+
# margin-top: 5px;
|
| 68 |
# }
|
| 69 |
+
# #nps-labels-row p {
|
| 70 |
+
# margin: 0;
|
| 71 |
# font-size: 0.9em;
|
| 72 |
# color: #666;
|
| 73 |
# }
|
| 74 |
+
|
| 75 |
+
# /* Styling for the submit button */
|
| 76 |
+
# #nps-submit-button {
|
| 77 |
+
# margin-top: 15px; /* Adds space above the submit button */
|
| 78 |
+
# width: 100%; /* Makes the button full width */
|
| 79 |
+
# }
|
| 80 |
# """
|
| 81 |
+
|
| 82 |
css = """
|
| 83 |
+
#nps-container {
|
| 84 |
+
background-color: #333; /* Dark gray background */
|
| 85 |
+
padding: 20px; /* Add some padding around the content */
|
| 86 |
+
border-radius: 8px; /* Optional: adds rounded corners */
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
#nps-buttons-container .gr-radio-group {
|
| 90 |
display: flex;
|
| 91 |
+
flex-direction: row;
|
| 92 |
+
justify-content: space-between; /* Spreads buttons evenly across the container */
|
| 93 |
+
gap: 5px;
|
| 94 |
+
flex-wrap: nowrap;
|
| 95 |
}
|
| 96 |
|
|
|
|
| 97 |
#nps-buttons-container .gr-radio-label {
|
| 98 |
display: flex;
|
| 99 |
justify-content: center;
|
| 100 |
align-items: center;
|
| 101 |
+
width: 35px;
|
| 102 |
+
height: 35px;
|
| 103 |
+
border-radius: 4px;
|
| 104 |
+
background-color: #555; /* A slightly lighter gray for the buttons */
|
| 105 |
color: white;
|
| 106 |
font-weight: bold;
|
| 107 |
cursor: pointer;
|
| 108 |
transition: background-color 0.2s ease;
|
| 109 |
+
font-size: 14px;
|
| 110 |
}
|
| 111 |
|
|
|
|
| 112 |
#nps-buttons-container .gr-radio-label:hover {
|
| 113 |
+
background-color: #777;
|
| 114 |
}
|
| 115 |
+
|
| 116 |
#nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
| 117 |
+
background-color: #999;
|
| 118 |
border: 2px solid white;
|
| 119 |
}
|
| 120 |
|
|
|
|
| 121 |
#nps-buttons-container .gr-radio-input {
|
| 122 |
display: none;
|
| 123 |
}
|
| 124 |
|
|
|
|
| 125 |
#nps-labels-row {
|
| 126 |
display: flex;
|
| 127 |
justify-content: space-between;
|
| 128 |
+
margin-top: 10px; /* Increased margin for more space */
|
| 129 |
+
color: #ccc; /* Lighter text color for readability on a dark background */
|
| 130 |
}
|
| 131 |
+
|
| 132 |
#nps-labels-row p {
|
| 133 |
margin: 0;
|
| 134 |
+
font-size: 1.0em; /* Larger font size for the labels */
|
|
|
|
| 135 |
}
|
| 136 |
|
|
|
|
| 137 |
#nps-submit-button {
|
| 138 |
+
margin-top: 20px; /* Increased space above the submit button */
|
| 139 |
+
width: 100%;
|
| 140 |
}
|
| 141 |
"""
|
| 142 |
|
|
|
|
| 202 |
#output_type = gr.Dropdown(choices=["Excel", "JSON", "TXT"], label="Select Output Format", value="Excel")
|
| 203 |
#download_button = gr.Button("⬇️ Download Output")
|
| 204 |
#download_file = gr.File(label="Download File Here",visible=False)
|
| 205 |
+
<br>
|
| 206 |
+
|
| 207 |
+
report_button = gr.Button("Report inaccurate output to receive 1 extra free query",elem_id="run-btn")
|
| 208 |
+
report_textbox = gr.Textbox(
|
| 209 |
label="Describe the issue",
|
| 210 |
lines=4,
|
| 211 |
placeholder="e.g. DQ981467: it gives me unknown when I can in fact search it on NCBI \n DQ981467: cannot find the result in batch output when the live processing did show already processed",
|
| 212 |
visible=False)
|
| 213 |
+
submit_report_button = gr.Button("Submit", visible=False, elem_id="run-btn")
|
| 214 |
+
status_report = gr.Markdown(visible=False)
|
| 215 |
|
| 216 |
+
with gr.Group(visible=True, elem_id="nps-overlay") as nps_modal:
|
| 217 |
+
#with gr.Column(elem_id="nps-box"):
|
| 218 |
+
with gr.Box(elem_id="nps-container"):
|
| 219 |
gr.Markdown("### How likely are you to recommend this tool to a colleague or peer?")
|
| 220 |
# # Use gr.Radio to create clickable buttons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
with gr.Column(elem_id="nps-buttons-container"):
|
| 222 |
nps_radio = gr.Radio(
|
| 223 |
choices=[str(i) for i in range(11)],
|