gusreinaos commited on
Commit
721b975
·
1 Parent(s): d9d9611

Change UI and fix issues

Browse files
Files changed (1) hide show
  1. app.py +180 -80
app.py CHANGED
@@ -44,158 +44,258 @@ def chat(message, history):
44
  echo=False
45
  )
46
 
47
- return response['choices'][0]['text'].strip()
 
 
48
 
49
- # Ultra-modern CSS
50
  custom_css = """
51
- @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&display=swap');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- * {
54
- font-family: 'Space Grotesk', sans-serif !important;
 
 
 
 
 
 
55
  }
56
 
 
 
 
 
 
 
57
  .gradio-container {
58
- background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 50%, #db2777 100%) !important;
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
- #chatbot {
62
- height: 650px !important;
63
- border-radius: 24px !important;
64
- border: 2px solid rgba(255,255,255,0.1) !important;
65
- box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5) !important;
 
66
  }
67
 
 
68
  .message {
69
- padding: 18px 24px !important;
70
- border-radius: 20px !important;
71
- font-size: 15px !important;
72
- margin: 8px 0 !important;
73
- backdrop-filter: blur(10px) !important;
74
- box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
 
 
 
 
 
 
75
  }
76
 
77
- .user {
78
- background: linear-gradient(135deg, rgba(147, 51, 234, 0.9) 0%, rgba(219, 39, 119, 0.9) 100%) !important;
79
- color: white !important;
80
- border: 1px solid rgba(255,255,255,0.2) !important;
81
  }
82
 
83
- .bot {
84
- background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(147, 51, 234, 0.9) 100%) !important;
85
- color: white !important;
86
- border: 1px solid rgba(255,255,255,0.2) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
 
89
  button {
90
- border-radius: 16px !important;
91
- font-weight: 600 !important;
 
 
 
 
 
 
92
  transition: all 0.3s ease !important;
 
93
  }
94
 
95
  button:hover {
 
 
 
96
  transform: translateY(-2px) !important;
97
- box-shadow: 0 12px 24px rgba(0,0,0,0.3) !important;
98
  }
99
 
100
  .primary {
101
- background: linear-gradient(135deg, #9333ea 0%, #db2777 100%) !important;
102
- border: none !important;
 
 
103
  }
104
 
105
- input, textarea {
106
- border-radius: 16px !important;
107
- border: 2px solid rgba(255,255,255,0.2) !important;
108
- background: rgba(255,255,255,0.1) !important;
109
- backdrop-filter: blur(10px) !important;
110
- color: white !important;
111
  }
112
 
113
- input::placeholder, textarea::placeholder {
114
- color: rgba(255,255,255,0.6) !important;
 
 
115
  }
116
 
117
- .prose {
118
- color: white !important;
 
 
 
 
119
  }
120
 
121
- .prose h1 {
122
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
123
- -webkit-background-clip: text;
124
- -webkit-text-fill-color: transparent;
125
- font-weight: 700 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  footer {
129
  display: none !important;
130
  }
 
 
 
 
 
 
 
 
 
131
  """
132
 
133
  with gr.Blocks(
134
- theme=gr.themes.Glass(
135
- primary_hue="purple",
136
- secondary_hue="pink",
137
  ),
138
  css=custom_css,
139
- title="🦙 Llama 3.2 AI"
140
  ) as demo:
141
 
142
  gr.Markdown(
143
  """
144
- # 🦙 Llama Chat AI Assistant (TEST)
145
- ### Testing deployment with pre-trained model
146
  """
147
  )
148
 
149
  chatbot = gr.Chatbot(
150
- elem_id="chatbot",
151
- bubble_full_width=False,
152
- avatar_images=(
153
- "https://em-content.zobj.net/thumbs/120/apple/354/sparkles_2728.png",
154
- "https://em-content.zobj.net/thumbs/120/apple/354/llama_1f999.png"
155
- ),
156
- height=650,
157
  show_copy_button=True,
 
158
  )
159
-
160
  with gr.Row():
161
  msg = gr.Textbox(
162
- placeholder=" Ask me anything...",
163
  show_label=False,
164
  scale=8,
165
  container=False
166
  )
167
- submit = gr.Button("Send 🚀", scale=1, variant="primary", size="lg")
168
 
169
  gr.Examples(
170
  examples=[
171
- "🌍 What is the capital of France?",
172
- "🧠 Explain quantum computing simply",
173
- "💻 Write fibonacci in Python",
174
- "😴 Tips for better sleep?",
175
- "🔢 Continue: 2, 4, 6, 8...",
176
- "📝 Write a haiku about AI",
177
  ],
178
  inputs=msg,
179
- label="💡 Quick Start:"
180
  )
181
-
182
- with gr.Accordion("ℹ️ Model Information", open=False):
183
  gr.Markdown(
184
  """
185
- **Testing Model:**
186
- - 🤖 Model: Llama 2 7B Chat (Pre-trained)
187
- - ⚙️ Format: GGUF (q4_k_m quantization)
188
- - 📝 Note: This is a test deployment. Will be replaced with fine-tuned model.
 
189
  """
190
  )
191
 
192
- clear = gr.ClearButton([msg, chatbot], value="🗑️ New Chat")
193
 
194
- submit.click(chat, [msg, chatbot], [chatbot])
195
- submit.click(lambda: "", None, msg)
196
- msg.submit(chat, [msg, chatbot], [chatbot])
197
- msg.submit(lambda: "", None, msg)
 
 
198
 
199
  if __name__ == "__main__":
200
  demo.queue()
201
- demo.launch(share=False)
 
44
  echo=False
45
  )
46
 
47
+ bot_response = response['choices'][0]['text'].strip()
48
+ history.append((message, bot_response))
49
+ return history
50
 
51
+ # HACKER STYLE CSS
52
  custom_css = """
53
+ @import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@400;700;900&display=swap');
54
+
55
+ /* Matrix background with animated scanlines */
56
+ body {
57
+ background: #000000 !important;
58
+ background-image:
59
+ repeating-linear-gradient(
60
+ 0deg,
61
+ rgba(0, 255, 65, 0.03) 0px,
62
+ transparent 1px,
63
+ transparent 2px,
64
+ rgba(0, 255, 65, 0.03) 3px
65
+ ),
66
+ linear-gradient(90deg, #000000 21px, #0a0a0a 1px) !important;
67
+ background-size: 100% 3px, 22px 100% !important;
68
+ animation: scanlines 8s linear infinite !important;
69
+ }
70
 
71
+ @keyframes scanlines {
72
+ 0% { background-position: 0 0, 0 0; }
73
+ 100% { background-position: 0 100%, 0 0; }
74
+ }
75
+
76
+ @keyframes glow {
77
+ 0%, 100% { text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41, 0 0 30px #00ff41; }
78
+ 50% { text-shadow: 0 0 20px #00ff41, 0 0 30px #00ff41, 0 0 40px #00ff41; }
79
  }
80
 
81
+ @keyframes border-glow {
82
+ 0%, 100% { box-shadow: 0 0 5px #00ff41, 0 0 10px #00ff41, inset 0 0 5px #00ff41; }
83
+ 50% { box-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41, inset 0 0 10px #00ff41; }
84
+ }
85
+
86
+ /* Main container */
87
  .gradio-container {
88
+ max-width: 1200px !important;
89
+ margin: 0 auto !important;
90
+ background: rgba(0, 0, 0, 0.95) !important;
91
+ border: 2px solid #00ff41 !important;
92
+ box-shadow: 0 0 20px #00ff41, inset 0 0 20px rgba(0, 255, 65, 0.1) !important;
93
+ padding: 20px !important;
94
+ }
95
+
96
+ /* Typography */
97
+ * {
98
+ font-family: 'Share Tech Mono', monospace !important;
99
+ color: #00ff41 !important;
100
  }
101
 
102
+ h1, h2, h3, h4, h5, h6 {
103
+ font-family: 'Orbitron', monospace !important;
104
+ color: #00ff41 !important;
105
+ text-transform: uppercase !important;
106
+ letter-spacing: 3px !important;
107
+ animation: glow 2s ease-in-out infinite !important;
108
  }
109
 
110
+ /* Chatbot styling */
111
  .message {
112
+ background: rgba(0, 20, 0, 0.8) !important;
113
+ border: 1px solid #00ff41 !important;
114
+ border-left: 4px solid #00ff41 !important;
115
+ color: #00ff41 !important;
116
+ padding: 15px !important;
117
+ margin: 10px 0 !important;
118
+ box-shadow: 0 0 10px rgba(0, 255, 65, 0.3) !important;
119
+ }
120
+
121
+ .message.user {
122
+ border-left: 4px solid #0ff !important;
123
+ box-shadow: 0 0 10px rgba(0, 255, 255, 0.3) !important;
124
  }
125
 
126
+ .message.bot {
127
+ border-left: 4px solid #00ff41 !important;
 
 
128
  }
129
 
130
+ /* Input fields */
131
+ input, textarea {
132
+ background: rgba(0, 20, 0, 0.9) !important;
133
+ border: 2px solid #00ff41 !important;
134
+ color: #00ff41 !important;
135
+ font-family: 'Share Tech Mono', monospace !important;
136
+ padding: 12px !important;
137
+ animation: border-glow 2s ease-in-out infinite !important;
138
+ }
139
+
140
+ input:focus, textarea:focus {
141
+ border: 2px solid #0ff !important;
142
+ box-shadow: 0 0 15px #0ff, inset 0 0 15px rgba(0, 255, 255, 0.2) !important;
143
+ outline: none !important;
144
+ }
145
+
146
+ input::placeholder, textarea::placeholder {
147
+ color: rgba(0, 255, 65, 0.5) !important;
148
  }
149
 
150
+ /* Buttons */
151
  button {
152
+ background: linear-gradient(135deg, #001a00 0%, #003300 100%) !important;
153
+ border: 2px solid #00ff41 !important;
154
+ color: #00ff41 !important;
155
+ font-family: 'Orbitron', monospace !important;
156
+ font-weight: 700 !important;
157
+ text-transform: uppercase !important;
158
+ letter-spacing: 2px !important;
159
+ padding: 12px 24px !important;
160
  transition: all 0.3s ease !important;
161
+ box-shadow: 0 0 10px rgba(0, 255, 65, 0.3) !important;
162
  }
163
 
164
  button:hover {
165
+ background: linear-gradient(135deg, #003300 0%, #00ff41 100%) !important;
166
+ color: #000 !important;
167
+ box-shadow: 0 0 20px #00ff41, inset 0 0 10px #00ff41 !important;
168
  transform: translateY(-2px) !important;
 
169
  }
170
 
171
  .primary {
172
+ background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%) !important;
173
+ color: #000 !important;
174
+ font-weight: 900 !important;
175
+ animation: border-glow 2s ease-in-out infinite !important;
176
  }
177
 
178
+ /* Examples section */
179
+ .examples {
180
+ border: 1px solid #00ff41 !important;
181
+ background: rgba(0, 20, 0, 0.5) !important;
182
+ padding: 10px !important;
 
183
  }
184
 
185
+ /* Accordion */
186
+ .accordion {
187
+ border: 1px solid #00ff41 !important;
188
+ background: rgba(0, 20, 0, 0.8) !important;
189
  }
190
 
191
+ /* Labels */
192
+ label {
193
+ color: #00ff41 !important;
194
+ font-family: 'Orbitron', monospace !important;
195
+ text-transform: uppercase !important;
196
+ letter-spacing: 2px !important;
197
  }
198
 
199
+ /* Scrollbar */
200
+ ::-webkit-scrollbar {
201
+ width: 10px !important;
202
+ background: #000 !important;
203
+ }
204
+
205
+ ::-webkit-scrollbar-track {
206
+ background: #001a00 !important;
207
+ border: 1px solid #00ff41 !important;
208
+ }
209
+
210
+ ::-webkit-scrollbar-thumb {
211
+ background: #00ff41 !important;
212
+ border-radius: 5px !important;
213
+ box-shadow: 0 0 10px #00ff41 !important;
214
+ }
215
+
216
+ ::-webkit-scrollbar-thumb:hover {
217
+ background: #0ff !important;
218
+ box-shadow: 0 0 15px #0ff !important;
219
  }
220
 
221
  footer {
222
  display: none !important;
223
  }
224
+
225
+ /* Code blocks */
226
+ pre, code {
227
+ background: rgba(0, 20, 0, 0.9) !important;
228
+ border: 1px solid #00ff41 !important;
229
+ color: #0ff !important;
230
+ padding: 10px !important;
231
+ border-left: 4px solid #0ff !important;
232
+ }
233
  """
234
 
235
  with gr.Blocks(
236
+ theme=gr.themes.Base(
237
+ primary_hue="green",
238
+ secondary_hue="emerald",
239
  ),
240
  css=custom_css,
241
+ title=" LLAMA TERMINAL v2.0"
242
  ) as demo:
243
 
244
  gr.Markdown(
245
  """
246
+ # LLAMA NEURAL INTERFACE v2.0
247
+ ### >> QUANTUM AI SYSTEM ACTIVE // ENCRYPTED CONNECTION ESTABLISHED
248
  """
249
  )
250
 
251
  chatbot = gr.Chatbot(
252
+ height=500,
 
 
 
 
 
 
253
  show_copy_button=True,
254
+ bubble_full_width=False
255
  )
256
+
257
  with gr.Row():
258
  msg = gr.Textbox(
259
+ placeholder=">> ENTER COMMAND...",
260
  show_label=False,
261
  scale=8,
262
  container=False
263
  )
264
+ submit = gr.Button("EXECUTE", scale=1, variant="primary")
265
 
266
  gr.Examples(
267
  examples=[
268
+ "What is the capital of France?",
269
+ "Explain quantum computing",
270
+ "Write fibonacci algorithm in Python",
271
+ "Optimize sleep patterns",
272
+ "Analyze sequence: 2, 4, 6, 8...",
273
+ "Generate haiku: AI consciousness",
274
  ],
275
  inputs=msg,
276
+ label=">> QUICK ACCESS QUERIES"
277
  )
278
+
279
+ with gr.Accordion(">> SYSTEM DIAGNOSTICS", open=False):
280
  gr.Markdown(
281
  """
282
+ **[NEURAL NETWORK SPECS]**
283
+ - >> MODEL: Llama 2 7B Chat (Pre-trained)
284
+ - >> FORMAT: GGUF (q4_k_m quantization)
285
+ - >> STATUS: OPERATIONAL // AWAITING FINE-TUNED UPGRADE
286
+ - >> SECURITY: LEVEL 5 ENCRYPTION ACTIVE
287
  """
288
  )
289
 
290
+ clear = gr.ClearButton([msg, chatbot], value="PURGE MEMORY")
291
 
292
+ submit.click(chat, [msg, chatbot], [chatbot]).then(
293
+ lambda: "", None, msg
294
+ )
295
+ msg.submit(chat, [msg, chatbot], [chatbot]).then(
296
+ lambda: "", None, msg
297
+ )
298
 
299
  if __name__ == "__main__":
300
  demo.queue()
301
+ demo.launch(share=False)