Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ def clear_chat():
|
|
| 52 |
return [], ""
|
| 53 |
|
| 54 |
# =====================================================
|
| 55 |
-
# CSS (Light/Dark + UI FIX
|
| 56 |
# =====================================================
|
| 57 |
custom_css = """
|
| 58 |
/* ---------- Color System ---------- */
|
|
@@ -129,7 +129,6 @@ h1 {
|
|
| 129 |
overflow-wrap: break-word !important;
|
| 130 |
|
| 131 |
box-sizing: border-box !important;
|
| 132 |
-
position: relative;
|
| 133 |
}
|
| 134 |
|
| 135 |
/* 🔧 REMOVE BLACK GHOST BLOCKS */
|
|
@@ -165,29 +164,6 @@ h1 {
|
|
| 165 |
border-bottom-left-radius: 4px;
|
| 166 |
}
|
| 167 |
|
| 168 |
-
/* ---------- Hover Copy/Edit ---------- */
|
| 169 |
-
.msg-actions {
|
| 170 |
-
display: none;
|
| 171 |
-
gap: 6px;
|
| 172 |
-
position: absolute;
|
| 173 |
-
bottom: -18px;
|
| 174 |
-
right: 6px;
|
| 175 |
-
}
|
| 176 |
-
|
| 177 |
-
.message:hover .msg-actions {
|
| 178 |
-
display: flex;
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
.msg-actions button {
|
| 182 |
-
font-size: 11px;
|
| 183 |
-
padding: 2px 6px;
|
| 184 |
-
border-radius: 6px;
|
| 185 |
-
border: none;
|
| 186 |
-
background: #00000055;
|
| 187 |
-
color: white;
|
| 188 |
-
cursor: pointer;
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
/* ---------- Input ---------- */
|
| 192 |
textarea {
|
| 193 |
background: var(--surface) !important;
|
|
@@ -243,7 +219,7 @@ with gr.Blocks(title="GROQ AI CHATBOT") as demo:
|
|
| 243 |
"<div class='subtitle'>Fast, reliable AI powered by Groq & LLaMA-3.3</div>"
|
| 244 |
)
|
| 245 |
|
| 246 |
-
chatbot = gr.Chatbot(elem_classes="chatbot"
|
| 247 |
state = gr.State([])
|
| 248 |
|
| 249 |
with gr.Row():
|
|
@@ -259,25 +235,8 @@ with gr.Blocks(title="GROQ AI CHATBOT") as demo:
|
|
| 259 |
txt.submit(chat_with_groq, [txt, state], [chatbot, txt])
|
| 260 |
clear.click(clear_chat, outputs=[chatbot, txt], show_progress=False)
|
| 261 |
|
| 262 |
-
gr.HTML("""
|
| 263 |
-
<script>
|
| 264 |
-
document.addEventListener("click", function(e){
|
| 265 |
-
if(e.target.classList.contains("copy-btn")){
|
| 266 |
-
const msg = e.target.closest(".message").innerText;
|
| 267 |
-
navigator.clipboard.writeText(msg);
|
| 268 |
-
}
|
| 269 |
-
if(e.target.classList.contains("edit-btn")){
|
| 270 |
-
const msg = e.target.closest(".message").innerText;
|
| 271 |
-
const box = document.querySelector("textarea");
|
| 272 |
-
box.value = msg;
|
| 273 |
-
box.focus();
|
| 274 |
-
}
|
| 275 |
-
});
|
| 276 |
-
</script>
|
| 277 |
-
""")
|
| 278 |
-
|
| 279 |
# =====================================================
|
| 280 |
-
# Launch
|
| 281 |
# =====================================================
|
| 282 |
if __name__ == "__main__":
|
| 283 |
demo.launch(css=custom_css)
|
|
|
|
| 52 |
return [], ""
|
| 53 |
|
| 54 |
# =====================================================
|
| 55 |
+
# CSS (Light/Dark + Gradio 6 UI FIX)
|
| 56 |
# =====================================================
|
| 57 |
custom_css = """
|
| 58 |
/* ---------- Color System ---------- */
|
|
|
|
| 129 |
overflow-wrap: break-word !important;
|
| 130 |
|
| 131 |
box-sizing: border-box !important;
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
/* 🔧 REMOVE BLACK GHOST BLOCKS */
|
|
|
|
| 164 |
border-bottom-left-radius: 4px;
|
| 165 |
}
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
/* ---------- Input ---------- */
|
| 168 |
textarea {
|
| 169 |
background: var(--surface) !important;
|
|
|
|
| 219 |
"<div class='subtitle'>Fast, reliable AI powered by Groq & LLaMA-3.3</div>"
|
| 220 |
)
|
| 221 |
|
| 222 |
+
chatbot = gr.Chatbot(elem_classes="chatbot")
|
| 223 |
state = gr.State([])
|
| 224 |
|
| 225 |
with gr.Row():
|
|
|
|
| 235 |
txt.submit(chat_with_groq, [txt, state], [chatbot, txt])
|
| 236 |
clear.click(clear_chat, outputs=[chatbot, txt], show_progress=False)
|
| 237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
# =====================================================
|
| 239 |
+
# Launch (Gradio 6)
|
| 240 |
# =====================================================
|
| 241 |
if __name__ == "__main__":
|
| 242 |
demo.launch(css=custom_css)
|