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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -25
app.py CHANGED
@@ -100,19 +100,14 @@ def gradio_fn(message, history):
100
  with gr.Blocks(css="""
101
  :root { --chat-w: 520px; }
102
 
103
- html, body {
104
- height: 100%;
105
- overflow-y: hidden; /* no page scroll */
106
- margin: 0;
107
- }
108
- /* Full-screen background image with a soft dark overlay */
109
  body {
110
  background:
111
  linear-gradient(0deg, rgba(0,0,0,.28), rgba(0,0,0,.28)),
112
- url("https://huggingface.co/spaces/JDhruv14/gita/resolve/main/bg.jpg") center / cover no-repeat fixed; /* <- change filename if needed */
 
113
  }
114
-
115
- /* Left-aligned, narrower chat panel */
116
  .gradio-container {
117
  max-width: var(--chat-w);
118
  width: var(--chat-w);
@@ -121,32 +116,52 @@ with gr.Blocks(css="""
121
  padding: 20px;
122
  font-family: sans-serif;
123
  position: relative;
124
-
125
- /* optional glass effect for readability */
126
  background: rgba(0,0,0,.30);
127
  border-radius: 16px;
128
  backdrop-filter: blur(6px);
129
  }
130
-
131
- .chatbot {
132
- height: 480px !important;
133
- overflow-y: auto;
134
- }
135
-
136
- @media (max-width: 720px){
137
- :root { --chat-w: 92vw; }
138
- .gradio-container { margin-left: 4vw; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
  """) as demo:
141
 
142
  gr.Markdown(
143
  """
144
- <div style='text-align: left; padding: 10px;'>
145
  <h1 style='font-size: 2.0em; margin-bottom: 0.2em;'><span style='color: #4F46E5;'>kRISHNA.ai</span></h1>
146
  <p style='font-size: 1.0em; color: #bbb;'>5000-Years of Ancient WISDOM with Modern AI ✨</p>
147
  </div>
148
- """,
149
- elem_id="header"
150
  )
151
 
152
  gr.ChatInterface(
@@ -157,9 +172,13 @@ with gr.Blocks(css="""
157
  "How do I forgive someone who hurt me deeply?",
158
  "What can I do to stop overthinking?"
159
  ],
160
- chatbot=gr.Chatbot(type="messages", elem_classes="chatbot"),
 
 
 
 
161
  type="messages",
162
  )
163
 
164
  if __name__ == "__main__":
165
- demo.launch()
 
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)),
108
+ url("https://huggingface.co/spaces/JDhruv14/gita/resolve/main/bg.jpg")
109
+ center / cover no-repeat fixed;
110
  }
 
 
111
  .gradio-container {
112
  max-width: var(--chat-w);
113
  width: var(--chat-w);
 
116
  padding: 20px;
117
  font-family: sans-serif;
118
  position: relative;
 
 
119
  background: rgba(0,0,0,.30);
120
  border-radius: 16px;
121
  backdrop-filter: blur(6px);
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
 
158
  gr.Markdown(
159
  """
160
+ <div id="header" style='text-align: left; padding: 10px;'>
161
  <h1 style='font-size: 2.0em; margin-bottom: 0.2em;'><span style='color: #4F46E5;'>kRISHNA.ai</span></h1>
162
  <p style='font-size: 1.0em; color: #bbb;'>5000-Years of Ancient WISDOM with Modern AI ✨</p>
163
  </div>
164
+ """
 
165
  )
166
 
167
  gr.ChatInterface(
 
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()