VyLala commited on
Commit
655ee38
·
verified ·
1 Parent(s): de2ea69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -31
app.py CHANGED
@@ -20,22 +20,29 @@ 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;
25
  # padding: 20px;
26
  # border-radius: 8px;
27
  # display: flex;
28
  # flex-direction: column;
29
- # width: 100%; /* Ensures the container takes up full width */
 
 
 
 
 
30
  # }
31
 
32
  # /* The container for the radio buttons */
33
  # #nps-radio-container .gr-radio-group {
34
  # display: flex;
35
  # flex-direction: row;
36
- # justify-content: space-between; /* Spreads buttons evenly across the container */
 
37
  # flex-wrap: nowrap;
38
- # width: 100%; /* Important: Makes the radio group fill its parent container */
39
  # }
40
 
41
  # /* Styling for each individual button */
@@ -69,29 +76,36 @@ with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
69
  # #nps-labels-row {
70
  # display: flex;
71
  # justify-content: space-between;
72
- # margin-top: 10px;
73
  # color: #ccc;
74
- # width: 100%; /* Important: Makes the label row fill its parent container */
75
  # }
76
 
77
  # #nps-labels-row p {
78
  # margin: 0;
79
  # font-size: 1.0em;
80
- # white-space: nowrap; /* Prevents text from wrapping */
 
 
 
 
 
 
 
81
  # }
82
 
83
  # #nps-submit-button {
84
- # margin-top: 20px;
85
  # width: 100%;
86
  # }
87
 
88
  # #nps-submit-button:active {
89
  # border-color: white !important;
90
  # box-shadow: 0 0 5px white inset;
91
- # }
92
- # """
93
  css = """
94
- /* NPS container for a unified background */
95
  #nps-container {
96
  background-color: #333;
97
  padding: 20px;
@@ -101,19 +115,17 @@ css = """
101
  width: 100%;
102
  }
103
 
104
- /* Question markdown styling */
105
- #nps-container .gr-markdown h3 {
106
- margin-bottom: 20px; /* Adds space between the question and the numbers */
 
107
  }
108
 
109
- /* The container for the radio buttons */
110
- #nps-radio-container .gr-radio-group {
111
- display: flex;
112
- flex-direction: row;
113
- justify-content: space-between;
114
- gap: 5px;
115
- flex-wrap: nowrap;
116
- width: 100%;
117
  }
118
 
119
  /* Styling for each individual button */
@@ -135,45 +147,51 @@ css = """
135
  #nps-radio-container .gr-radio-label:hover {
136
  background-color: #777;
137
  }
 
138
  #nps-radio-container input[type="radio"]:checked + .gr-radio-label {
139
  background-color: #999;
140
  border: 2px solid white;
141
  }
 
142
  #nps-radio-container .gr-radio-input {
143
  display: none;
144
  }
145
 
146
- /* Adjusting the text labels for "Not likely" and "Extremely likely" */
147
  #nps-labels-row {
148
  display: flex;
149
  justify-content: space-between;
150
- margin-top: 15px; /* Adds more space below the numbers */
151
- color: #ccc;
152
- width: 100%;
153
  }
154
 
155
- #nps-labels-row p {
156
  margin: 0;
157
  font-size: 1.0em;
 
158
  white-space: nowrap;
159
- width: 50%; /* Ensures each label takes up half the row */
160
  }
161
- #nps-labels-row p:first-child {
 
162
  text-align: left;
163
  }
164
- #nps-labels-row p:last-child {
 
165
  text-align: right;
166
  }
167
 
 
168
  #nps-submit-button {
169
- margin-top: 25px; /* Adds a larger space above the submit button */
170
  width: 100%;
171
  }
172
 
173
  #nps-submit-button:active {
174
  border-color: white !important;
175
  box-shadow: 0 0 5px white inset;
176
- }"""
 
177
 
178
  with gr.Blocks() as interface:
179
  # with gr.Tab("CURIOUS ABOUT THIS PRODUCT?"):
 
20
  flow_chart = f.read()
21
 
22
  # css = """
23
+ # /* NPS container for a unified background */
24
  # #nps-container {
25
  # background-color: #333;
26
  # padding: 20px;
27
  # border-radius: 8px;
28
  # display: flex;
29
  # flex-direction: column;
30
+ # width: 100%;
31
+ # }
32
+
33
+ # /* Question markdown styling */
34
+ # #nps-container .gr-markdown h3 {
35
+ # margin-bottom: 20px; /* Adds space between the question and the numbers */
36
  # }
37
 
38
  # /* The container for the radio buttons */
39
  # #nps-radio-container .gr-radio-group {
40
  # display: flex;
41
  # flex-direction: row;
42
+ # justify-content: space-between;
43
+ # gap: 5px;
44
  # flex-wrap: nowrap;
45
+ # width: 100%;
46
  # }
47
 
48
  # /* Styling for each individual button */
 
76
  # #nps-labels-row {
77
  # display: flex;
78
  # justify-content: space-between;
79
+ # margin-top: 15px; /* Adds more space below the numbers */
80
  # color: #ccc;
81
+ # width: 100%;
82
  # }
83
 
84
  # #nps-labels-row p {
85
  # margin: 0;
86
  # font-size: 1.0em;
87
+ # white-space: nowrap;
88
+ # width: 50%; /* Ensures each label takes up half the row */
89
+ # }
90
+ # #nps-labels-row p:first-child {
91
+ # text-align: left;
92
+ # }
93
+ # #nps-labels-row p:last-child {
94
+ # text-align: right;
95
  # }
96
 
97
  # #nps-submit-button {
98
+ # margin-top: 25px; /* Adds a larger space above the submit button */
99
  # width: 100%;
100
  # }
101
 
102
  # #nps-submit-button:active {
103
  # border-color: white !important;
104
  # box-shadow: 0 0 5px white inset;
105
+ # }"""
106
+
107
  css = """
108
+ /* The main container for the entire NPS section */
109
  #nps-container {
110
  background-color: #333;
111
  padding: 20px;
 
115
  width: 100%;
116
  }
117
 
118
+ /* Ensure the question text is properly spaced */
119
+ #nps-container h3 {
120
+ color: #fff;
121
+ margin-bottom: 20px; /* Space between question and buttons */
122
  }
123
 
124
+ /* This is the key change: Target the radio group directly and force its layout */
125
+ #nps-container > .gr-row > div > div {
126
+ display: flex !important;
127
+ justify-content: space-between !important;
128
+ width: 100% !important;
 
 
 
129
  }
130
 
131
  /* Styling for each individual button */
 
147
  #nps-radio-container .gr-radio-label:hover {
148
  background-color: #777;
149
  }
150
+
151
  #nps-radio-container input[type="radio"]:checked + .gr-radio-label {
152
  background-color: #999;
153
  border: 2px solid white;
154
  }
155
+
156
  #nps-radio-container .gr-radio-input {
157
  display: none;
158
  }
159
 
160
+ /* The row for the "Not likely" and "Extremely likely" labels */
161
  #nps-labels-row {
162
  display: flex;
163
  justify-content: space-between;
164
+ margin-top: 15px; /* Adds space below the number buttons */
165
+ width: 100%; /* Force labels row to take full width */
 
166
  }
167
 
168
+ #nps-labels-row .gr-markdown p {
169
  margin: 0;
170
  font-size: 1.0em;
171
+ color: #ccc;
172
  white-space: nowrap;
173
+ width: 50%;
174
  }
175
+
176
+ #nps-labels-row .gr-markdown:first-child p {
177
  text-align: left;
178
  }
179
+
180
+ #nps-labels-row .gr-markdown:last-child p {
181
  text-align: right;
182
  }
183
 
184
+ /* Submit button styling */
185
  #nps-submit-button {
186
+ margin-top: 25px; /* Adds space above the submit button */
187
  width: 100%;
188
  }
189
 
190
  #nps-submit-button:active {
191
  border-color: white !important;
192
  box-shadow: 0 0 5px white inset;
193
+ }
194
+ """
195
 
196
  with gr.Blocks() as interface:
197
  # with gr.Tab("CURIOUS ABOUT THIS PRODUCT?"):