JDhruv14 commited on
Commit
3e25e48
·
verified ·
1 Parent(s): ff92fee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -39
app.py CHANGED
@@ -96,45 +96,49 @@ def gradio_fn(message, history):
96
  max_new=512,
97
  min_new=0,
98
  )
 
99
  with gr.Blocks(css="""
100
- :root { --chat-w: 520px; } /* ↓ change this to shrink/grow the chat */
101
 
102
- .gradio-container {
103
- max-width: var(--chat-w); /* narrower chat */
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  width: var(--chat-w);
105
- margin-left: 16px; /* align left */
106
- margin-right: auto; /* push away from right */
107
- padding: 20px;
108
- font-family: sans-serif;
109
- position: relative;
110
- }
111
-
112
- .chatbot {
113
- height: 480px !important; /* a bit smaller; tweak as you like */
114
- overflow-y: auto;
115
- }
116
-
117
- /* corner images (optional) */
118
- .corner {
119
- position: fixed;
120
- bottom: 8px;
121
- z-index: 5;
122
- pointer-events: none;
123
- }
124
- #left { left: 8px; }
125
- #right { right: 8px; bottom: 96px; } /* lift Krishna a bit */
126
- .corner img {
127
- height: min(62vh, 760px);
128
- width: auto;
129
  }
130
 
131
- /* mobile safety */
132
  @media (max-width: 720px){
133
  :root { --chat-w: 92vw; }
134
  .gradio-container { margin-left: 4vw; }
135
  }
136
  """) as demo:
137
-
138
  gr.Markdown(
139
  """
140
  <div style='text-align: left; padding: 10px;'>
@@ -145,7 +149,7 @@ with gr.Blocks(css="""
145
  elem_id="header"
146
  )
147
 
148
- chat = gr.ChatInterface(
149
  fn=gradio_fn,
150
  examples=[
151
  "Hello!",
@@ -157,14 +161,5 @@ with gr.Blocks(css="""
157
  type="messages",
158
  )
159
 
160
- gr.HTML("""
161
- <div id="left" class="corner">
162
- <img src="/file=arjuna.png" alt="Arjun">
163
- </div>
164
- <div id="right" class="corner">
165
- <img src="/file=krishna.png" alt="Krishna">
166
- </div>
167
- """)
168
-
169
  if __name__ == "__main__":
170
  demo.launch()
 
96
  max_new=512,
97
  min_new=0,
98
  )
99
+
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("/file=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);
119
+ margin-left: 16px;
120
+ margin-right: auto;
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;'>
 
149
  elem_id="header"
150
  )
151
 
152
+ gr.ChatInterface(
153
  fn=gradio_fn,
154
  examples=[
155
  "Hello!",
 
161
  type="messages",
162
  )
163
 
 
 
 
 
 
 
 
 
 
164
  if __name__ == "__main__":
165
  demo.launch()