Spaces:
Running
on
Zero
Running
on
Zero
fix mobile chat input being cut off
Browse files- Change chatbot height from fixed 500px to responsive 60vh
- Replace fixed positioning with proper layout flow (works in iframes)
- Add touch-friendly styles (16px font prevents iOS zoom)
- Add larger touch targets for mobile buttons
- Compact TTS audio and settings on mobile
- Add extra small screen optimizations
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -736,29 +736,77 @@ CUSTOM_CSS = """
|
|
| 736 |
button.primary { font-weight: 600; }
|
| 737 |
.gradio-accordion { margin-bottom: 12px; }
|
| 738 |
|
| 739 |
-
/* Mobile
|
| 740 |
@media (max-width: 768px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
#input-row {
|
| 742 |
-
|
| 743 |
-
|
| 744 |
-
left: 0;
|
| 745 |
-
right: 0;
|
| 746 |
-
background: var(--background-fill-primary);
|
| 747 |
-
padding: 12px;
|
| 748 |
-
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
| 749 |
-
z-index: 1000;
|
| 750 |
margin: 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
}
|
| 752 |
|
| 753 |
-
/*
|
| 754 |
-
.
|
| 755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 756 |
}
|
| 757 |
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
max-height: none !important;
|
| 762 |
}
|
| 763 |
}
|
| 764 |
"""
|
|
@@ -769,11 +817,12 @@ with gr.Blocks(title="LLM Inference with ZeroGPU") as demo:
|
|
| 769 |
|
| 770 |
# Main Chat Interface
|
| 771 |
chat = gr.Chatbot(
|
| 772 |
-
height=
|
| 773 |
label="💬 Conversation",
|
| 774 |
buttons=["copy"],
|
| 775 |
avatar_images=(None, "pfp.png"),
|
| 776 |
-
layout="bubble"
|
|
|
|
| 777 |
)
|
| 778 |
|
| 779 |
# TTS Audio Output (visible by default since TTS is on)
|
|
|
|
| 736 |
button.primary { font-weight: 600; }
|
| 737 |
.gradio-accordion { margin-bottom: 12px; }
|
| 738 |
|
| 739 |
+
/* Mobile optimizations */
|
| 740 |
@media (max-width: 768px) {
|
| 741 |
+
/* Constrain the chatbot height on mobile to leave room for input */
|
| 742 |
+
#chat-window, .chatbot {
|
| 743 |
+
height: calc(100vh - 350px) !important;
|
| 744 |
+
min-height: 200px !important;
|
| 745 |
+
max-height: calc(100vh - 350px) !important;
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
/* Hide the TTS audio component label on mobile to save space */
|
| 749 |
+
#tts-audio {
|
| 750 |
+
margin: 4px 0 !important;
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
/* Compact the audio player on mobile */
|
| 754 |
+
#tts-audio audio {
|
| 755 |
+
height: 40px !important;
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
/* Style the input row */
|
| 759 |
#input-row {
|
| 760 |
+
background: var(--background-fill-primary, #1f2937) !important;
|
| 761 |
+
padding: 8px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
margin: 0 !important;
|
| 763 |
+
border-top: 1px solid var(--border-color-primary, #374151) !important;
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
/* Make textbox more touch-friendly */
|
| 767 |
+
#input-row textarea {
|
| 768 |
+
font-size: 16px !important; /* Prevents iOS zoom on focus */
|
| 769 |
+
min-height: 44px !important;
|
| 770 |
+
padding: 10px !important;
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
/* Larger touch targets for buttons */
|
| 774 |
+
#input-row button {
|
| 775 |
+
min-height: 44px !important;
|
| 776 |
+
min-width: 60px !important;
|
| 777 |
+
padding: 8px 12px !important;
|
| 778 |
}
|
| 779 |
|
| 780 |
+
/* Compact settings accordion on mobile */
|
| 781 |
+
.gradio-accordion {
|
| 782 |
+
margin: 4px 0 !important;
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
.gradio-accordion summary {
|
| 786 |
+
font-size: 14px !important;
|
| 787 |
+
padding: 8px !important;
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
/* Reduce overall padding in the container */
|
| 791 |
+
.gradio-container {
|
| 792 |
+
padding: 8px !important;
|
| 793 |
+
}
|
| 794 |
+
}
|
| 795 |
+
|
| 796 |
+
/* Extra small screens (phones in portrait) */
|
| 797 |
+
@media (max-width: 480px) {
|
| 798 |
+
#chat-window, .chatbot {
|
| 799 |
+
height: calc(100vh - 380px) !important;
|
| 800 |
+
max-height: calc(100vh - 380px) !important;
|
| 801 |
+
}
|
| 802 |
+
|
| 803 |
+
#input-row {
|
| 804 |
+
padding: 6px !important;
|
| 805 |
}
|
| 806 |
|
| 807 |
+
#input-row button {
|
| 808 |
+
min-width: 50px !important;
|
| 809 |
+
font-size: 12px !important;
|
|
|
|
| 810 |
}
|
| 811 |
}
|
| 812 |
"""
|
|
|
|
| 817 |
|
| 818 |
# Main Chat Interface
|
| 819 |
chat = gr.Chatbot(
|
| 820 |
+
height="60vh",
|
| 821 |
label="💬 Conversation",
|
| 822 |
buttons=["copy"],
|
| 823 |
avatar_images=(None, "pfp.png"),
|
| 824 |
+
layout="bubble",
|
| 825 |
+
elem_id="chat-window"
|
| 826 |
)
|
| 827 |
|
| 828 |
# TTS Audio Output (visible by default since TTS is on)
|