Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,89 +19,100 @@ 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 |
-
# Define the CSS to control layout and styling
|
23 |
# css = """
|
24 |
-
#
|
|
|
|
|
|
|
|
|
|
|
25 |
# #nps-buttons-container .gr-radio-group {
|
26 |
# display: flex;
|
27 |
-
# flex-direction: row;
|
28 |
-
# justify-content:
|
29 |
-
# gap: 5px;
|
30 |
-
# flex-wrap: nowrap;
|
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;
|
39 |
-
# height: 35px;
|
40 |
-
# border-radius: 4px;
|
41 |
-
# background-color: #
|
42 |
# color: white;
|
43 |
# font-weight: bold;
|
44 |
# cursor: pointer;
|
45 |
# transition: background-color 0.2s ease;
|
46 |
-
# font-size: 14px;
|
47 |
# }
|
48 |
|
49 |
-
# /* Hover and selected states */
|
50 |
# #nps-buttons-container .gr-radio-label:hover {
|
51 |
-
# background-color: #
|
52 |
# }
|
|
|
53 |
# #nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
54 |
-
# background-color: #
|
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:
|
|
|
68 |
# }
|
|
|
69 |
# #nps-labels-row p {
|
70 |
# margin: 0;
|
71 |
-
# font-size:
|
72 |
-
# color: #666;
|
73 |
# }
|
74 |
|
75 |
-
# /* Styling for the submit button */
|
76 |
# #nps-submit-button {
|
77 |
-
# margin-top:
|
78 |
-
# width: 100%;
|
|
|
|
|
|
|
|
|
|
|
79 |
# }
|
80 |
# """
|
81 |
-
|
82 |
css = """
|
83 |
#nps-container {
|
84 |
-
background-color: #333;
|
85 |
-
padding: 20px;
|
86 |
-
border-radius: 8px;
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
-
|
|
|
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 |
-
|
|
|
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;
|
105 |
color: white;
|
106 |
font-weight: bold;
|
107 |
cursor: pointer;
|
@@ -109,41 +120,41 @@ css = """
|
|
109 |
font-size: 14px;
|
110 |
}
|
111 |
|
112 |
-
#nps-
|
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;
|
129 |
-
color: #ccc;
|
|
|
130 |
}
|
131 |
|
132 |
#nps-labels-row p {
|
133 |
margin: 0;
|
134 |
-
font-size: 1.0em;
|
|
|
135 |
}
|
136 |
|
137 |
#nps-submit-button {
|
138 |
-
margin-top: 20px;
|
139 |
width: 100%;
|
140 |
}
|
141 |
-
|
142 |
#nps-submit-button:active {
|
143 |
border-color: white !important;
|
144 |
box-shadow: 0 0 5px white inset;
|
145 |
}
|
146 |
-
"""
|
147 |
|
148 |
with gr.Blocks() as interface:
|
149 |
# with gr.Tab("CURIOUS ABOUT THIS PRODUCT?"):
|
@@ -201,56 +212,56 @@ with gr.Blocks() as interface:
|
|
201 |
|
202 |
# gr.Markdown("---")
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
report_button = gr.Button("Report inaccurate output to receive 1 extra free query",elem_id="run-btn")
|
214 |
-
report_textbox = gr.Textbox(
|
215 |
-
label="Describe the issue",
|
216 |
-
lines=4,
|
217 |
-
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",
|
218 |
-
visible=False)
|
219 |
-
submit_report_button = gr.Button("Submit", visible=False, elem_id="run-btn")
|
220 |
-
status_report = gr.Markdown(visible=False)
|
221 |
-
|
222 |
-
# Use gr.Markdown to add a visual space
|
223 |
-
gr.Markdown(" ") # A simple blank markdown can create space
|
224 |
-
|
225 |
-
download_file = gr.File(label="Download File Here", visible=False, interactive=True)
|
226 |
-
gr.Markdown(" ") # A simple blank markdown can create space
|
227 |
-
|
228 |
-
with gr.Group(visible=True, elem_id="nps-overlay") as nps_modal:
|
229 |
-
#with gr.Column(elem_id="nps-box"):
|
230 |
-
with gr.Group(elem_id="nps-container"):
|
231 |
-
gr.Markdown("### How likely are you to recommend this tool to a colleague or peer?")
|
232 |
-
# # Use gr.Radio to create clickable buttons
|
233 |
-
with gr.Column(elem_id="nps-buttons-container"):
|
234 |
-
nps_radio = gr.Radio(
|
235 |
-
choices=[str(i) for i in range(11)],
|
236 |
-
label="Select score:",
|
237 |
-
interactive=True,
|
238 |
-
container=False
|
239 |
-
)
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
253 |
|
|
|
|
|
254 |
# gr.Markdown("### 💬 Feedback (required)")
|
255 |
# q1 = gr.Textbox(label="1️⃣ Was the inferred location accurate or helpful? Please explain.")
|
256 |
# q2 = gr.Textbox(label="2️⃣ What would improve your experience with this tool?")
|
|
|
19 |
with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
|
20 |
flow_chart = f.read()
|
21 |
|
|
|
22 |
# css = """
|
23 |
+
# #nps-container {
|
24 |
+
# background-color: #333; /* Dark gray background */
|
25 |
+
# padding: 20px; /* Add some padding around the content */
|
26 |
+
# border-radius: 8px; /* Optional: adds rounded corners */
|
27 |
+
# }
|
28 |
+
|
29 |
# #nps-buttons-container .gr-radio-group {
|
30 |
# display: flex;
|
31 |
+
# flex-direction: row;
|
32 |
+
# justify-content: space-between; /* Spreads buttons evenly across the container */
|
33 |
+
# gap: 5px;
|
34 |
+
# flex-wrap: nowrap;
|
35 |
# }
|
36 |
|
|
|
37 |
# #nps-buttons-container .gr-radio-label {
|
38 |
# display: flex;
|
39 |
# justify-content: center;
|
40 |
# align-items: center;
|
41 |
+
# width: 35px;
|
42 |
+
# height: 35px;
|
43 |
+
# border-radius: 4px;
|
44 |
+
# background-color: #555; /* A slightly lighter gray for the buttons */
|
45 |
# color: white;
|
46 |
# font-weight: bold;
|
47 |
# cursor: pointer;
|
48 |
# transition: background-color 0.2s ease;
|
49 |
+
# font-size: 14px;
|
50 |
# }
|
51 |
|
|
|
52 |
# #nps-buttons-container .gr-radio-label:hover {
|
53 |
+
# background-color: #777;
|
54 |
# }
|
55 |
+
|
56 |
# #nps-buttons-container input[type="radio"]:checked + .gr-radio-label {
|
57 |
+
# background-color: #999;
|
58 |
# border: 2px solid white;
|
59 |
# }
|
60 |
|
|
|
61 |
# #nps-buttons-container .gr-radio-input {
|
62 |
# display: none;
|
63 |
# }
|
64 |
|
|
|
65 |
# #nps-labels-row {
|
66 |
# display: flex;
|
67 |
# justify-content: space-between;
|
68 |
+
# margin-top: 10px; /* Increased margin for more space */
|
69 |
+
# color: #ccc; /* Lighter text color for readability on a dark background */
|
70 |
# }
|
71 |
+
|
72 |
# #nps-labels-row p {
|
73 |
# margin: 0;
|
74 |
+
# font-size: 1.0em; /* Larger font size for the labels */
|
|
|
75 |
# }
|
76 |
|
|
|
77 |
# #nps-submit-button {
|
78 |
+
# margin-top: 20px; /* Increased space above the submit button */
|
79 |
+
# width: 100%;
|
80 |
+
# }
|
81 |
+
# /* Active click style for the NPS submit button */
|
82 |
+
# #nps-submit-button:active {
|
83 |
+
# border-color: white !important;
|
84 |
+
# box-shadow: 0 0 5px white inset;
|
85 |
# }
|
86 |
# """
|
87 |
+
# Define the CSS to control the layout and styling
|
88 |
css = """
|
89 |
#nps-container {
|
90 |
+
background-color: #333;
|
91 |
+
padding: 20px;
|
92 |
+
border-radius: 8px;
|
93 |
+
display: flex;
|
94 |
+
flex-direction: column;
|
95 |
+
width: 100%; /* Ensures the container takes up full width */
|
96 |
}
|
97 |
|
98 |
+
/* The container for the radio buttons */
|
99 |
+
#nps-radio-container .gr-radio-group {
|
100 |
display: flex;
|
101 |
flex-direction: row;
|
102 |
justify-content: space-between; /* Spreads buttons evenly across the container */
|
|
|
103 |
flex-wrap: nowrap;
|
104 |
+
width: 100%; /* Important: Makes the radio group fill its parent container */
|
105 |
}
|
106 |
|
107 |
+
/* Styling for each individual button */
|
108 |
+
#nps-radio-container .gr-radio-label {
|
109 |
display: flex;
|
110 |
justify-content: center;
|
111 |
align-items: center;
|
112 |
width: 35px;
|
113 |
height: 35px;
|
114 |
border-radius: 4px;
|
115 |
+
background-color: #555;
|
116 |
color: white;
|
117 |
font-weight: bold;
|
118 |
cursor: pointer;
|
|
|
120 |
font-size: 14px;
|
121 |
}
|
122 |
|
123 |
+
#nps-radio-container .gr-radio-label:hover {
|
124 |
background-color: #777;
|
125 |
}
|
126 |
+
#nps-radio-container input[type="radio"]:checked + .gr-radio-label {
|
|
|
127 |
background-color: #999;
|
128 |
border: 2px solid white;
|
129 |
}
|
130 |
+
#nps-radio-container .gr-radio-input {
|
|
|
131 |
display: none;
|
132 |
}
|
133 |
|
134 |
+
/* Adjusting the text labels for "Not likely" and "Extremely likely" */
|
135 |
#nps-labels-row {
|
136 |
display: flex;
|
137 |
justify-content: space-between;
|
138 |
+
margin-top: 10px;
|
139 |
+
color: #ccc;
|
140 |
+
width: 100%; /* Important: Makes the label row fill its parent container */
|
141 |
}
|
142 |
|
143 |
#nps-labels-row p {
|
144 |
margin: 0;
|
145 |
+
font-size: 1.0em;
|
146 |
+
white-space: nowrap; /* Prevents text from wrapping */
|
147 |
}
|
148 |
|
149 |
#nps-submit-button {
|
150 |
+
margin-top: 20px;
|
151 |
width: 100%;
|
152 |
}
|
153 |
+
|
154 |
#nps-submit-button:active {
|
155 |
border-color: white !important;
|
156 |
box-shadow: 0 0 5px white inset;
|
157 |
}
|
|
|
158 |
|
159 |
with gr.Blocks() as interface:
|
160 |
# with gr.Tab("CURIOUS ABOUT THIS PRODUCT?"):
|
|
|
212 |
|
213 |
# gr.Markdown("---")
|
214 |
|
215 |
+
with gr.Accordion("Open to See the Output Table", open=True) as table_accordion:
|
216 |
+
output_table = gr.HTML(render=True)
|
217 |
+
#with gr.Row():
|
218 |
+
#output_type = gr.Dropdown(choices=["Excel", "JSON", "TXT"], label="Select Output Format", value="Excel")
|
219 |
+
#download_button = gr.Button("⬇️ Download Output")
|
220 |
+
#download_file = gr.File(label="Download File Here",visible=False)
|
221 |
+
# Use gr.Markdown to add a visual space
|
222 |
+
gr.Markdown(" ") # A simple blank markdown can create space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
+
report_button = gr.Button("Report inaccurate output to receive 1 extra free query",elem_id="run-btn")
|
225 |
+
report_textbox = gr.Textbox(
|
226 |
+
label="Describe the issue",
|
227 |
+
lines=4,
|
228 |
+
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",
|
229 |
+
visible=False)
|
230 |
+
submit_report_button = gr.Button("Submit", visible=False, elem_id="run-btn")
|
231 |
+
status_report = gr.Markdown(visible=False)
|
232 |
+
|
233 |
+
# Use gr.Markdown to add a visual space
|
234 |
+
gr.Markdown(" ") # A simple blank markdown can create space
|
235 |
+
|
236 |
+
download_file = gr.File(label="Download File Here", visible=False, interactive=True)
|
237 |
+
gr.Markdown(" ") # A simple blank markdown can create space
|
238 |
|
239 |
+
with gr.Group(visible=True, elem_id="nps-overlay") as nps_modal:
|
240 |
+
#with gr.Column(elem_id="nps-box"):
|
241 |
+
with gr.Group(elem_id="nps-container"):
|
242 |
+
gr.Markdown("### How likely are you to recommend this tool to a colleague or peer?")
|
243 |
+
# # Use gr.Radio to create clickable buttons
|
244 |
+
with gr.Column(elem_id="nps-buttons-container"):
|
245 |
+
nps_radio = gr.Radio(
|
246 |
+
choices=[str(i) for i in range(11)],
|
247 |
+
label="Select score:",
|
248 |
+
interactive=True,
|
249 |
+
container=False
|
250 |
+
)
|
251 |
+
|
252 |
+
# The "Not likely" and "Extremely likely" labels
|
253 |
+
with gr.Row(elem_id="nps-labels-row"):
|
254 |
+
gr.Markdown("Not likely")
|
255 |
+
gr.Markdown("Extremely likely")
|
256 |
|
257 |
+
nps_submit = gr.Button("Submit", elem_id="nps-submit-button")
|
258 |
+
nps_output = gr.Textbox(label="", interactive=False, visible=True)
|
259 |
+
gr.Markdown(" ") # A simple blank markdown can create space
|
260 |
+
|
261 |
+
progress_box = gr.Textbox(label="Live Processing Log", lines=20, interactive=False)
|
262 |
|
263 |
+
gr.Markdown("---")
|
264 |
+
|
265 |
# gr.Markdown("### 💬 Feedback (required)")
|
266 |
# q1 = gr.Textbox(label="1️⃣ Was the inferred location accurate or helpful? Please explain.")
|
267 |
# q2 = gr.Textbox(label="2️⃣ What would improve your experience with this tool?")
|