Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -216,9 +216,82 @@ body {
|
|
216 |
}
|
217 |
"""
|
218 |
|
|
|
219 |
# Interface Gradio
|
220 |
def demo():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue", secondary_hue="gray"), css=custom_css) as demo:
|
|
|
|
|
|
|
222 |
vector_db = gr.State()
|
223 |
qa_chain = gr.State()
|
224 |
collection_name = gr.State()
|
|
|
216 |
}
|
217 |
"""
|
218 |
|
219 |
+
# Interface Gradio
|
220 |
# Interface Gradio
|
221 |
def demo():
|
222 |
+
# CSS personalizado com a faixa de cobertura
|
223 |
+
custom_css = """
|
224 |
+
#banner {
|
225 |
+
display: none !important;
|
226 |
+
}
|
227 |
+
footer {
|
228 |
+
display: none !important;
|
229 |
+
}
|
230 |
+
/* Estilo do botão de controle */
|
231 |
+
#toggle-bar-btn {
|
232 |
+
position: fixed;
|
233 |
+
top: 10px;
|
234 |
+
right: 10px;
|
235 |
+
z-index: 10000;
|
236 |
+
background: #2563eb;
|
237 |
+
color: white;
|
238 |
+
border: none;
|
239 |
+
padding: 8px 16px;
|
240 |
+
border-radius: 4px;
|
241 |
+
cursor: pointer;
|
242 |
+
font-size: 14px;
|
243 |
+
font-weight: 500;
|
244 |
+
transition: background-color 0.2s;
|
245 |
+
}
|
246 |
+
#toggle-bar-btn:hover {
|
247 |
+
background: #1d4ed8;
|
248 |
+
}
|
249 |
+
/* Estilo da faixa de cobertura */
|
250 |
+
#cover-bar {
|
251 |
+
display: none;
|
252 |
+
position: fixed;
|
253 |
+
top: 0;
|
254 |
+
left: 0;
|
255 |
+
right: 0;
|
256 |
+
height: 64px;
|
257 |
+
background: white;
|
258 |
+
z-index: 9999;
|
259 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
260 |
+
transition: all 0.3s ease;
|
261 |
+
}
|
262 |
+
/* Classe para mostrar a faixa */
|
263 |
+
#cover-bar.visible {
|
264 |
+
display: block;
|
265 |
+
}
|
266 |
+
/* Ajustes do container principal */
|
267 |
+
.gradio-container {
|
268 |
+
margin-top: 0 !important;
|
269 |
+
}
|
270 |
+
"""
|
271 |
+
|
272 |
+
# HTML para o botão e a faixa
|
273 |
+
cover_bar_html = """
|
274 |
+
<div id="cover-bar"></div>
|
275 |
+
<button id="toggle-bar-btn" onclick="toggleCoverBar()">Ocultar Barra</button>
|
276 |
+
<script>
|
277 |
+
function toggleCoverBar() {
|
278 |
+
const coverBar = document.getElementById('cover-bar');
|
279 |
+
const btn = document.getElementById('toggle-bar-btn');
|
280 |
+
if (coverBar.classList.contains('visible')) {
|
281 |
+
coverBar.classList.remove('visible');
|
282 |
+
btn.textContent = 'Ocultar Barra';
|
283 |
+
} else {
|
284 |
+
coverBar.classList.add('visible');
|
285 |
+
btn.textContent = 'Mostrar Barra';
|
286 |
+
}
|
287 |
+
}
|
288 |
+
</script>
|
289 |
+
"""
|
290 |
+
|
291 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue", secondary_hue="gray"), css=custom_css) as demo:
|
292 |
+
# Adiciona o HTML do botão e faixa de cobertura
|
293 |
+
gr.HTML(cover_bar_html)
|
294 |
+
|
295 |
vector_db = gr.State()
|
296 |
qa_chain = gr.State()
|
297 |
collection_name = gr.State()
|