VyLala commited on
Commit
5b746ce
·
verified ·
1 Parent(s): 4a80cd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -27
app.py CHANGED
@@ -21,27 +21,32 @@ with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
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;
@@ -49,59 +54,66 @@ with open("mtdna_tool_explainer_updated.html", "r", encoding="utf-8") as f:
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 */
@@ -135,27 +147,33 @@ css = """
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
 
160
  with gr.Blocks() as interface:
161
  # with gr.Tab("CURIOUS ABOUT THIS PRODUCT?"):
@@ -235,6 +253,7 @@ with gr.Blocks() as interface:
235
  gr.Markdown(" ") # A simple blank markdown can create space
236
 
237
  download_file = gr.File(label="Download File Here", visible=False, interactive=True)
 
238
  gr.Markdown(" ") # A simple blank markdown can create space
239
 
240
  with gr.Group(visible=True, elem_id="nps-overlay") as nps_modal:
 
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 */
42
+ # #nps-radio-container .gr-radio-label {
43
  # display: flex;
44
  # justify-content: center;
45
  # align-items: center;
46
  # width: 35px;
47
  # height: 35px;
48
  # border-radius: 4px;
49
+ # background-color: #555;
50
  # color: white;
51
  # font-weight: bold;
52
  # cursor: pointer;
 
54
  # font-size: 14px;
55
  # }
56
 
57
+ # #nps-radio-container .gr-radio-label:hover {
58
  # background-color: #777;
59
  # }
60
+ # #nps-radio-container input[type="radio"]:checked + .gr-radio-label {
 
61
  # background-color: #999;
62
  # border: 2px solid white;
63
  # }
64
+ # #nps-radio-container .gr-radio-input {
 
65
  # display: none;
66
  # }
67
 
68
+ # /* Adjusting the text labels for "Not likely" and "Extremely likely" */
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;
98
  border-radius: 8px;
99
  display: flex;
100
  flex-direction: column;
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 */
 
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?"):
 
253
  gr.Markdown(" ") # A simple blank markdown can create space
254
 
255
  download_file = gr.File(label="Download File Here", visible=False, interactive=True)
256
+
257
  gr.Markdown(" ") # A simple blank markdown can create space
258
 
259
  with gr.Group(visible=True, elem_id="nps-overlay") as nps_modal: