Update app.py
Browse files
app.py
CHANGED
@@ -176,6 +176,8 @@ css = """
|
|
176 |
gap: 8px;
|
177 |
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
178 |
transition: background-color 0.2s;
|
|
|
|
|
179 |
}
|
180 |
.thinking-toggle:hover {
|
181 |
background-color: rgba(40, 40, 50, 0.9);
|
@@ -205,16 +207,18 @@ css = """
|
|
205 |
transition: transform 0.3s;
|
206 |
}
|
207 |
.thinking-content {
|
208 |
-
background-color: rgba(30, 30, 40, 0.
|
209 |
-
border-left:
|
210 |
-
padding:
|
211 |
margin-top: 5px;
|
|
|
212 |
font-size: 0.95em;
|
213 |
color: #e2e8f0;
|
214 |
font-family: monospace;
|
215 |
white-space: pre-wrap;
|
216 |
overflow-x: auto;
|
217 |
border-radius: 5px;
|
|
|
218 |
}
|
219 |
.hidden {
|
220 |
display: none;
|
@@ -230,25 +234,41 @@ function setupThinkingToggle() {
|
|
230 |
const content = this.nextElementSibling;
|
231 |
content.classList.toggle('hidden');
|
232 |
const arrow = this.querySelector('.dropdown-arrow');
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
});
|
235 |
button.hasEventListener = true;
|
236 |
}
|
237 |
});
|
238 |
}
|
239 |
|
240 |
-
//
|
241 |
-
setupThinkingToggle();
|
242 |
const observer = new MutationObserver(function(mutations) {
|
243 |
setupThinkingToggle();
|
244 |
});
|
245 |
|
246 |
-
// Start observing the
|
247 |
document.addEventListener('DOMContentLoaded', () => {
|
|
|
248 |
setTimeout(() => {
|
249 |
const chatbot = document.querySelector('.chatbot');
|
250 |
if (chatbot) {
|
251 |
-
observer.observe(chatbot, {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
}, 1000);
|
254 |
});
|
@@ -256,7 +276,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
256 |
|
257 |
theme = gr.themes.Soft()
|
258 |
|
259 |
-
with gr.Blocks(title="Athena Playground Chat", css=css, theme=theme) as demo:
|
260 |
gr.Markdown("# 🚀 Athena Playground Chat")
|
261 |
gr.Markdown("*Powered by HuggingFace ZeroGPU*")
|
262 |
|
@@ -329,9 +349,6 @@ with gr.Blocks(title="Athena Playground Chat", css=css, theme=theme) as demo:
|
|
329 |
Some Athena models (particularly R3X series) include reasoning in `<think></think>` tags.
|
330 |
Click on "Thinking completed" to view the model's thought process behind its answers.
|
331 |
""")
|
332 |
-
|
333 |
-
# Add the JavaScript to handle the thinking toggle buttons
|
334 |
-
demo.load(None, None, None, _js=js)
|
335 |
|
336 |
if __name__ == "__main__":
|
337 |
demo.launch(debug=True) # Enable debug mode for better error reporting
|
|
|
176 |
gap: 8px;
|
177 |
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
178 |
transition: background-color 0.2s;
|
179 |
+
width: auto;
|
180 |
+
max-width: 280px;
|
181 |
}
|
182 |
.thinking-toggle:hover {
|
183 |
background-color: rgba(40, 40, 50, 0.9);
|
|
|
207 |
transition: transform 0.3s;
|
208 |
}
|
209 |
.thinking-content {
|
210 |
+
background-color: rgba(30, 30, 40, 0.8);
|
211 |
+
border-left: 2px solid #6366f1;
|
212 |
+
padding: 15px;
|
213 |
margin-top: 5px;
|
214 |
+
margin-bottom: 15px;
|
215 |
font-size: 0.95em;
|
216 |
color: #e2e8f0;
|
217 |
font-family: monospace;
|
218 |
white-space: pre-wrap;
|
219 |
overflow-x: auto;
|
220 |
border-radius: 5px;
|
221 |
+
line-height: 1.5;
|
222 |
}
|
223 |
.hidden {
|
224 |
display: none;
|
|
|
234 |
const content = this.nextElementSibling;
|
235 |
content.classList.toggle('hidden');
|
236 |
const arrow = this.querySelector('.dropdown-arrow');
|
237 |
+
if (content.classList.contains('hidden')) {
|
238 |
+
arrow.textContent = '▼';
|
239 |
+
arrow.style.transform = '';
|
240 |
+
} else {
|
241 |
+
arrow.textContent = '▲';
|
242 |
+
arrow.style.transform = 'rotate(0deg)';
|
243 |
+
}
|
244 |
});
|
245 |
button.hasEventListener = true;
|
246 |
}
|
247 |
});
|
248 |
}
|
249 |
|
250 |
+
// Setup a mutation observer to watch for changes in the DOM
|
|
|
251 |
const observer = new MutationObserver(function(mutations) {
|
252 |
setupThinkingToggle();
|
253 |
});
|
254 |
|
255 |
+
// Start observing the document body for changes
|
256 |
document.addEventListener('DOMContentLoaded', () => {
|
257 |
+
setupThinkingToggle();
|
258 |
setTimeout(() => {
|
259 |
const chatbot = document.querySelector('.chatbot');
|
260 |
if (chatbot) {
|
261 |
+
observer.observe(chatbot, {
|
262 |
+
childList: true,
|
263 |
+
subtree: true,
|
264 |
+
characterData: true
|
265 |
+
});
|
266 |
+
} else {
|
267 |
+
// If chatbot container not found, observe the body
|
268 |
+
observer.observe(document.body, {
|
269 |
+
childList: true,
|
270 |
+
subtree: true
|
271 |
+
});
|
272 |
}
|
273 |
}, 1000);
|
274 |
});
|
|
|
276 |
|
277 |
theme = gr.themes.Soft()
|
278 |
|
279 |
+
with gr.Blocks(title="Athena Playground Chat", css=css, theme=theme, js=js) as demo:
|
280 |
gr.Markdown("# 🚀 Athena Playground Chat")
|
281 |
gr.Markdown("*Powered by HuggingFace ZeroGPU*")
|
282 |
|
|
|
349 |
Some Athena models (particularly R3X series) include reasoning in `<think></think>` tags.
|
350 |
Click on "Thinking completed" to view the model's thought process behind its answers.
|
351 |
""")
|
|
|
|
|
|
|
352 |
|
353 |
if __name__ == "__main__":
|
354 |
demo.launch(debug=True) # Enable debug mode for better error reporting
|