JDhruv14 commited on
Commit
2f09f40
·
verified ·
1 Parent(s): 93dadeb

Update app.py

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