Commit
•
117ade9
1
Parent(s):
9ec1c14
Added a to top button
Browse files
app.py
CHANGED
@@ -141,8 +141,46 @@ def search_logging(x: str, request: gr.Request):
|
|
141 |
session_id = getattr(request.cookies, 'access-token')
|
142 |
logger.flag(['', x, session_id, str(datetime.now())])
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
with gr.Blocks(css=
|
146 |
with gr.Row():
|
147 |
with gr.Column(min_width = 10):
|
148 |
with gr.Row():
|
@@ -161,6 +199,7 @@ with gr.Blocks(css="style.css") as app:
|
|
161 |
search_button = gr.Button(value="Search!")
|
162 |
with gr.Row():
|
163 |
output_df = gr.HTML()
|
|
|
164 |
search_button.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
|
165 |
search_prompt.submit(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
|
166 |
search_button.click(search_logging, inputs=[search_prompt], outputs=None)
|
|
|
141 |
session_id = getattr(request.cookies, 'access-token')
|
142 |
logger.flag(['', x, session_id, str(datetime.now())])
|
143 |
|
144 |
+
back_to_top_btn_html = '''
|
145 |
+
<button id="toTopBtn" onclick="'parentIFrame' in window ? window.parentIFrame.scrollTo({top: 0, behavior:'smooth'}) : window.scrollTo({ top: 0 })">
|
146 |
+
<a style="color:white; text-decoration:none;">Back to Top!</a>
|
147 |
+
</button>
|
148 |
+
'''
|
149 |
+
|
150 |
+
|
151 |
+
style = '''
|
152 |
+
footer{
|
153 |
+
display: none !important;
|
154 |
+
}
|
155 |
+
|
156 |
+
td img{
|
157 |
+
background-image:
|
158 |
+
linear-gradient(45deg, lightgrey 25%, transparent 25%),
|
159 |
+
linear-gradient(135deg, lightgrey 25%, transparent 25%),
|
160 |
+
linear-gradient(45deg, transparent 75%, lightgrey 75%),
|
161 |
+
linear-gradient(135deg, transparent 75%, lightgrey 75%);
|
162 |
+
|
163 |
+
background-size: 20px 20px;
|
164 |
+
background-position: 0 0, 10px 0, 10px -10px, 0px 10px;
|
165 |
+
}
|
166 |
+
#toTopBtn {
|
167 |
+
position: fixed;
|
168 |
+
bottom: 10px;
|
169 |
+
float: right;
|
170 |
+
right: 18.5%;
|
171 |
+
left: 77.25%;
|
172 |
+
height: 30px;
|
173 |
+
max-width: 100px;
|
174 |
+
width: 100%;
|
175 |
+
font-size: 12px;
|
176 |
+
border-color: rgba(217,24,120, .5);
|
177 |
+
background-color: rgba(35,153,249,.5);
|
178 |
+
padding: .5px;
|
179 |
+
border-radius: 4px;
|
180 |
+
}
|
181 |
+
'''
|
182 |
|
183 |
+
with gr.Blocks(css=style) as app:
|
184 |
with gr.Row():
|
185 |
with gr.Column(min_width = 10):
|
186 |
with gr.Row():
|
|
|
199 |
search_button = gr.Button(value="Search!")
|
200 |
with gr.Row():
|
201 |
output_df = gr.HTML()
|
202 |
+
back_top_btn = gr.HTML(back_to_top_btn_html)
|
203 |
search_button.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
|
204 |
search_prompt.submit(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search], outputs=output_df)
|
205 |
search_button.click(search_logging, inputs=[search_prompt], outputs=None)
|