JDhruv14 commited on
Commit
93dadeb
·
verified ·
1 Parent(s): 5602ac1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -31
app.py CHANGED
@@ -100,8 +100,8 @@ def gradio_fn(message, history):
100
  with gr.Blocks(css="""
101
  :root { --chat-w: 520px; }
102
 
 
103
  html, body { height: 100%; margin: 0; }
104
- /* Desktop / tablet (default) */
105
  body {
106
  background:
107
  linear-gradient(0deg, rgba(0,0,0,.28), rgba(0,0,0,.28)),
@@ -122,36 +122,40 @@ with gr.Blocks(css="""
122
  }
123
  .chatbot { height: 480px !important; overflow-y: auto; }
124
 
125
- /* ======== MOBILE PORTRAIT: chat only ======== */
126
- @media (max-width: 720px) and (orientation: portrait) {
127
- /* remove page scroll and any background art */
128
- html, body { overflow: hidden; }
129
- body { background: #0e0e10; } /* solid bg; no image */
130
 
131
- /* make the app full-screen and edge-to-edge */
132
  .gradio-container {
133
- max-width: 100vw;
134
- width: 100vw;
135
- height: 100vh;
136
- margin: 0;
137
- padding: 8px 10px;
138
- border-radius: 0;
139
- background: transparent; /* no glass */
140
- backdrop-filter: none;
141
  }
142
 
143
- /* hide header + examples so only chat is visible */
144
  #header { display: none !important; }
145
- .examples, [class*="examples"], [data-testid="examples"] { display: none !important; }
146
-
147
- /* stretch the chat area to fill the screen */
148
- .chatbot {
149
- height: calc(100vh - 110px) !important; /* room for input bar */
150
- overflow-y: auto;
 
 
 
 
151
  }
152
 
153
- /* hide any component labels/titles that take space */
154
- .gradio-container .label { display: none !important; }
 
155
  }
156
  """) as demo:
157
 
@@ -166,19 +170,16 @@ with gr.Blocks(css="""
166
 
167
  gr.ChatInterface(
168
  fn=gradio_fn,
169
- examples=[
170
- "Hello!",
171
- "How can I overcome fear of failure?",
172
- "How do I forgive someone who hurt me deeply?",
173
- "What can I do to stop overthinking?"
174
- ],
175
  chatbot=gr.Chatbot(
176
  type="messages",
177
  elem_classes="chatbot",
178
- show_label=False # no "Chatbot" title bar
179
  ),
180
  type="messages",
181
  )
182
 
183
  if __name__ == "__main__":
184
  demo.launch()
 
 
100
  with gr.Blocks(css="""
101
  :root { --chat-w: 520px; }
102
 
103
+ /* ---------- Desktop / Tablet (default) ---------- */
104
  html, body { height: 100%; margin: 0; }
 
105
  body {
106
  background:
107
  linear-gradient(0deg, rgba(0,0,0,.28), rgba(0,0,0,.28)),
 
122
  }
123
  .chatbot { height: 480px !important; overflow-y: auto; }
124
 
125
+ /* ---------- MOBILE PORTRAIT: CHAT ONLY ---------- */
126
+ @media (max-width: 750px) and (orientation: portrait) {
127
+ html, body { height: 100svh; overflow: hidden; } /* use small viewport height on mobile */
128
+ body { background: #0e0e10 !important; } /* no image on mobile */
 
129
 
130
+ /* make the app full screen and remove padding/borders */
131
  .gradio-container {
132
+ max-width: 100vw !important;
133
+ width: 100vw !important;
134
+ height: 100svh !important;
135
+ margin: 0 !important;
136
+ padding: 0 !important;
137
+ border-radius: 0 !important;
138
+ background: #0e0e10 !important;
139
+ backdrop-filter: none !important;
140
  }
141
 
142
+ /* hide header + any example chips/buttons */
143
  #header { display: none !important; }
144
+ [data-testid*="examples"],
145
+ .examples,
146
+ [class*="examples"] { display: none !important; }
147
+
148
+ /* stretch the Chatbot to fill the viewport (leaving room for the input bar) */
149
+ .gradio-container .gr-chatbot,
150
+ .gradio-container .chatbot {
151
+ height: calc(100svh - 110px) !important; /* tweak 110px if your input bar is taller/shorter */
152
+ max-height: calc(100svh - 110px) !important;
153
+ overflow-y: auto !important;
154
  }
155
 
156
+ /* kill any stray labels/titles */
157
+ .gradio-container .label,
158
+ .gradio-container [data-testid="block-label"] { display: none !important; }
159
  }
160
  """) as demo:
161
 
 
170
 
171
  gr.ChatInterface(
172
  fn=gradio_fn,
173
+ # remove examples entirely to avoid chips on mobile
174
+ examples=None,
 
 
 
 
175
  chatbot=gr.Chatbot(
176
  type="messages",
177
  elem_classes="chatbot",
178
+ show_label=False
179
  ),
180
  type="messages",
181
  )
182
 
183
  if __name__ == "__main__":
184
  demo.launch()
185
+