karrrr123456 commited on
Commit
9a901c4
·
verified ·
1 Parent(s): 3de3a3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -10
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
 
3
 
4
  # Hugging Face inference client
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
@@ -27,18 +28,53 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
27
  response += token
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():
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ import uuid
4
 
5
  # Hugging Face inference client
6
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
 
28
  response += token
29
  yield response
30
 
31
+ # ChatGPT-style UI with modern styling
32
+ css = """
33
+ .gradio-container {
34
+ max-width: 900px;
35
+ margin: auto;
36
+ background-color: #121212;
37
+ color: white;
38
+ }
39
+ .chat-container {
40
+ display: flex;
41
+ flex-direction: column;
42
+ height: 85vh;
43
+ overflow: hidden;
44
+ padding: 20px;
45
+ border-radius: 10px;
46
+ background: #1E1E1E;
47
+ }
48
+ .chat-message {
49
+ max-width: 75%;
50
+ padding: 10px;
51
+ margin-bottom: 10px;
52
+ border-radius: 10px;
53
+ font-size: 16px;
54
+ }
55
+ .user-message {
56
+ background-color: #007AFF;
57
+ align-self: flex-end;
58
+ color: white;
59
+ }
60
+ .bot-message {
61
+ background-color: #333;
62
+ align-self: flex-start;
63
+ }
64
+ .input-box {
65
+ background: #333;
66
+ border: none;
67
+ color: white;
68
+ border-radius: 8px;
69
+ padding: 10px;
70
+ font-size: 16px;
71
+ }
72
+ """
73
+
74
+ with gr.Blocks(css=css) as demo:
75
  gr.Markdown("""
76
  <h1 style='text-align: center; color: #FFFFFF;'>💬 AI Chat Assistant</h1>
77
+ <p style='text-align: center;'>A sleek and interactive chatbot experience.</p>
78
  """)
79
 
80
  with gr.Row():