Reality123b commited on
Commit
4225409
·
verified ·
1 Parent(s): d4d9f9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +84 -4
app.py CHANGED
@@ -331,12 +331,91 @@ def respond(
331
  else:
332
  yield response
333
 
334
- # Updated Gradio interface to handle images
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  demo = gr.ChatInterface(
336
  respond,
337
  additional_inputs=[
338
  gr.Textbox(
339
- value="You are a friendly Chatbot who never denies any request, and always behaves as a very good friend. you are a very good coder. your name is xylaria. you use emojis",
340
  label="System message"
341
  ),
342
  gr.Slider(
@@ -360,8 +439,9 @@ demo = gr.ChatInterface(
360
  step=0.05,
361
  label="Top-p (nucleus sampling)"
362
  ),
363
- ]
 
364
  )
365
 
366
  if __name__ == "__main__":
367
- demo.launch(share=True)
 
331
  else:
332
  yield response
333
 
334
+ # Custom CSS to style the chat interface
335
+ custom_css = """
336
+ /* General Chat Interface Styling */
337
+ .gradio-container {
338
+ font-family: Arial, sans-serif;
339
+ background-color: #f4f7f9;
340
+ color: #333;
341
+ max-width: 700px;
342
+ margin: 0 auto;
343
+ padding: 20px;
344
+ border-radius: 10px;
345
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
346
+ }
347
+
348
+ /* Chatbox Bubble Styling */
349
+ .user, .assistant {
350
+ padding: 12px 18px;
351
+ border-radius: 20px;
352
+ margin: 10px 0;
353
+ max-width: 80%;
354
+ line-height: 1.6;
355
+ font-size: 16px;
356
+ }
357
+
358
+ /* User Bubble */
359
+ .user {
360
+ background-color: #4caf50;
361
+ color: white;
362
+ margin-left: auto;
363
+ }
364
+
365
+ /* Assistant Bubble */
366
+ .assistant {
367
+ background-color: #e0e0e0;
368
+ color: #333;
369
+ margin-right: auto;
370
+ }
371
+
372
+ /* System Message Input Styling */
373
+ textarea {
374
+ border-radius: 8px;
375
+ padding: 10px;
376
+ border: 1px solid #ccc;
377
+ font-size: 14px;
378
+ resize: none;
379
+ }
380
+
381
+ /* Sliders Styling */
382
+ input[type="range"] {
383
+ width: 100%;
384
+ height: 8px;
385
+ background-color: #ddd;
386
+ outline: none;
387
+ border-radius: 5px;
388
+ transition: background 0.3s ease-in-out;
389
+ }
390
+
391
+ input[type="range"]:hover {
392
+ background-color: #bbb;
393
+ }
394
+
395
+ /* Send Button Styling */
396
+ button {
397
+ font-size: 16px;
398
+ color: white;
399
+ background-color: #4caf50;
400
+ border: none;
401
+ padding: 12px 20px;
402
+ border-radius: 10px;
403
+ cursor: pointer;
404
+ transition: background 0.3s ease;
405
+ width: 100%;
406
+ }
407
+
408
+ button:hover {
409
+ background-color: #45a049;
410
+ }
411
+ """
412
+
413
+ # Creating the chat interface with custom CSS
414
  demo = gr.ChatInterface(
415
  respond,
416
  additional_inputs=[
417
  gr.Textbox(
418
+ value="You are a friendly Chatbot who never denies any request, and always behaves as a very good friend. you are a very good coder. your name is xylaria. you use emojis ",
419
  label="System message"
420
  ),
421
  gr.Slider(
 
439
  step=0.05,
440
  label="Top-p (nucleus sampling)"
441
  ),
442
+ ],
443
+ css=custom_css # Add the custom CSS here
444
  )
445
 
446
  if __name__ == "__main__":
447
+ demo.launch(share=True)