Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -346,6 +346,43 @@ def generate_response(message: str, history: List[List[str]], system_prompt: str
|
|
346 |
logger.error(error_msg)
|
347 |
yield error_msg
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
# Create Gradio ChatInterface
|
350 |
chatbot = gr.ChatInterface(
|
351 |
generate_response,
|
@@ -354,7 +391,8 @@ chatbot = gr.ChatInterface(
|
|
354 |
"https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/1f464.png", # User avatar (person emoji)
|
355 |
"https://cdn-avatars.huggingface.co/v1/production/uploads/64e6d37e02dee9bcb9d9fa18/o_HhUnXb_PgyYlqJ6gfEO.png" # Bot avatar
|
356 |
],
|
357 |
-
height="64vh"
|
|
|
358 |
),
|
359 |
additional_inputs=[
|
360 |
gr.Textbox(
|
@@ -375,7 +413,8 @@ chatbot = gr.ChatInterface(
|
|
375 |
],
|
376 |
title="🤖 DQ Micro Agent",
|
377 |
description="DevQuasar self hosted Micro Agent with websearch capabilities",
|
378 |
-
theme="finlaymacklon/smooth_slate"
|
|
|
379 |
)
|
380 |
|
381 |
if __name__ == "__main__":
|
|
|
346 |
logger.error(error_msg)
|
347 |
yield error_msg
|
348 |
|
349 |
+
# CSS to fix avatar distortion and positioning issues
|
350 |
+
avatar_css = """
|
351 |
+
/* Fix avatar image distortion and positioning */
|
352 |
+
.avatar-container img {
|
353 |
+
width: 40px !important;
|
354 |
+
height: 40px !important;
|
355 |
+
border-radius: 50% !important;
|
356 |
+
object-fit: cover !important;
|
357 |
+
margin: 0px !important;
|
358 |
+
padding: 0px !important;
|
359 |
+
display: block !important;
|
360 |
+
}
|
361 |
+
|
362 |
+
/* Fix message row positioning */
|
363 |
+
.message-row img {
|
364 |
+
margin: 0px !important;
|
365 |
+
padding: 0px !important;
|
366 |
+
}
|
367 |
+
|
368 |
+
/* Additional fix for Gradio v5 centering issues */
|
369 |
+
.message img {
|
370 |
+
width: 40px !important;
|
371 |
+
height: 40px !important;
|
372 |
+
border-radius: 50% !important;
|
373 |
+
object-fit: cover !important;
|
374 |
+
margin: 0px !important;
|
375 |
+
padding: 0px !important;
|
376 |
+
}
|
377 |
+
|
378 |
+
/* Ensure proper aspect ratio for all chatbot images */
|
379 |
+
#chatbot img {
|
380 |
+
aspect-ratio: 1 !important;
|
381 |
+
object-fit: cover !important;
|
382 |
+
border-radius: 50% !important;
|
383 |
+
}
|
384 |
+
"""
|
385 |
+
|
386 |
# Create Gradio ChatInterface
|
387 |
chatbot = gr.ChatInterface(
|
388 |
generate_response,
|
|
|
391 |
"https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/1f464.png", # User avatar (person emoji)
|
392 |
"https://cdn-avatars.huggingface.co/v1/production/uploads/64e6d37e02dee9bcb9d9fa18/o_HhUnXb_PgyYlqJ6gfEO.png" # Bot avatar
|
393 |
],
|
394 |
+
height="64vh",
|
395 |
+
elem_id="chatbot"
|
396 |
),
|
397 |
additional_inputs=[
|
398 |
gr.Textbox(
|
|
|
413 |
],
|
414 |
title="🤖 DQ Micro Agent",
|
415 |
description="DevQuasar self hosted Micro Agent with websearch capabilities",
|
416 |
+
theme="finlaymacklon/smooth_slate",
|
417 |
+
css=avatar_css
|
418 |
)
|
419 |
|
420 |
if __name__ == "__main__":
|