karrrr123456 commited on
Commit
869a289
·
verified ·
1 Parent(s): a38c765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -29
app.py CHANGED
@@ -28,10 +28,17 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
28
  yield response
29
 
30
  # Enhanced UI with ChatGPT-like design
31
- with gr.Blocks(theme=gr.themes.Default()) as demo:
 
 
 
 
 
 
 
32
  gr.Markdown("""
33
- <h1 style='text-align: center;'>💬 AI Chat Assistant</h1>
34
- <p style='text-align: center;'>A sleek and interactive chatbot experience powered by AI.</p>
35
  """)
36
 
37
  with gr.Row():
@@ -40,7 +47,6 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
40
  label="System Message",
41
  interactive=True,
42
  show_label=False,
43
- elem_id="system-message",
44
  )
45
 
46
  with gr.Row():
@@ -54,30 +60,11 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
54
  minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"
55
  )
56
 
57
- with gr.Box():
58
- chatbot = gr.ChatInterface(
59
- respond,
60
- additional_inputs=[system_message, max_tokens, temperature, top_p],
61
- bubble_colors=("#007AFF", "#E5E5EA"),
62
- show_copy_button=True,
63
- elem_id="chat-container"
64
- )
65
-
66
- gr.Markdown("""
67
- <style>
68
- #chat-container {
69
- max-width: 800px;
70
- margin: auto;
71
- border-radius: 10px;
72
- background: #f7f7f8;
73
- padding: 20px;
74
- }
75
-
76
- #system-message input {
77
- font-size: 16px;
78
- border-radius: 8px;
79
- }
80
- </style>
81
- """)
82
 
83
  demo.launch()
 
28
  yield response
29
 
30
  # Enhanced UI with ChatGPT-like design
31
+ with gr.Blocks(css="""
32
+ body {background-color: #212121; color: #EAEAEA; font-family: Arial, sans-serif;}
33
+ .chat-container { max-width: 800px; margin: auto; padding: 20px; }
34
+ .chat-message { border-radius: 10px; padding: 10px 15px; margin: 5px 0; max-width: 80%; }
35
+ .user-message { background: #007AFF; color: white; align-self: flex-end; }
36
+ .bot-message { background: #333333; color: white; align-self: flex-start; }
37
+ .gradio-container { max-width: 900px; margin: auto; }
38
+ """) as demo:
39
  gr.Markdown("""
40
+ <h1 style='text-align: center; color: #FFFFFF;'>💬 AI Chat Assistant</h1>
41
+ <p style='text-align: center;'>An interactive chatbot experience with a modern UI.</p>
42
  """)
43
 
44
  with gr.Row():
 
47
  label="System Message",
48
  interactive=True,
49
  show_label=False,
 
50
  )
51
 
52
  with gr.Row():
 
60
  minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"
61
  )
62
 
63
+ chatbot = gr.ChatInterface(
64
+ respond,
65
+ additional_inputs=[system_message, max_tokens, temperature, top_p],
66
+ bubble_colors=("#007AFF", "#444444"),
67
+ show_copy_button=True,
68
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  demo.launch()