VenkateshRoshan commited on
Commit
3452f40
·
1 Parent(s): 427a4f5
Files changed (2) hide show
  1. app.py +90 -22
  2. style.css +0 -68
app.py CHANGED
@@ -42,28 +42,96 @@ def respond(
42
  """
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
- demo = gr.ChatInterface(
46
- respond,
47
- additional_inputs=[
48
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
49
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
50
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
- gr.Slider(
52
- minimum=0.1,
53
- maximum=1.0,
54
- value=0.95,
55
- step=0.05,
56
- label="Top-p (nucleus sampling)",
57
- ),
58
- ],
59
- )
60
-
61
- # read css file
62
- def readCSS(file):
63
- with open(file) as f:
64
- return f.read()
65
-
66
- demo.css = readCSS("style.css")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  if __name__ == "__main__":
69
  demo.launch()
 
42
  """
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
+ # demo = gr.ChatInterface(
46
+ # respond,
47
+ # additional_inputs=[
48
+ # gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
49
+ # gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
50
+ # gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
+ # gr.Slider(
52
+ # minimum=0.1,
53
+ # maximum=1.0,
54
+ # value=0.95,
55
+ # step=0.05,
56
+ # label="Top-p (nucleus sampling)",
57
+ # ),
58
+ # ],
59
+ # )
60
+
61
+ custom_css = """
62
+ /* styles.css */
63
+ #chatbox {
64
+ background-color: #ece5dd;
65
+ border-radius: 8px;
66
+ max-height: 400px;
67
+ overflow-y: auto;
68
+ padding: 10px;
69
+ display: flex;
70
+ flex-direction: column;
71
+ }
72
+
73
+ .message {
74
+ margin-bottom: 10px;
75
+ display: flex;
76
+ align-items: center;
77
+ }
78
+
79
+ .message.user {
80
+ justify-content: flex-end;
81
+ }
82
+
83
+ .message.bot {
84
+ justify-content: flex-start;
85
+ }
86
+
87
+ .message .text {
88
+ background-color: #ffffff;
89
+ border-radius: 10px;
90
+ padding: 10px;
91
+ max-width: 80%;
92
+ line-height: 1.4;
93
+ }
94
+
95
+ .message.user .text {
96
+ background-color: #dcf8c6;
97
+ }
98
+
99
+ .message.bot .text {
100
+ background-color: #ffffff;
101
+ }
102
+
103
+ .message .timestamp {
104
+ font-size: 0.8em;
105
+ color: #999;
106
+ }
107
+
108
+ #input-box {
109
+ margin-top: 10px;
110
+ display: flex;
111
+ }
112
+
113
+ #input-box textarea {
114
+ width: 80%;
115
+ border: 1px solid #ccc;
116
+ border-radius: 5px;
117
+ padding: 10px;
118
+ resize: none;
119
+ }
120
+
121
+ #input-box button {
122
+ width: 20%;
123
+ border: none;
124
+ border-radius: 5px;
125
+ background-color: #007bff;
126
+ color: white;
127
+ cursor: pointer;
128
+ padding: 10px;
129
+ }
130
+
131
+ """
132
+
133
+ with gr.Blocks(css=custom_css) as demo:
134
+ gr.Markdown("## Zephyr Chatbot")
135
 
136
  if __name__ == "__main__":
137
  demo.launch()
style.css CHANGED
@@ -1,68 +0,0 @@
1
- /* styles.css */
2
- #chatbox {
3
- background-color: #ece5dd;
4
- border-radius: 8px;
5
- max-height: 400px;
6
- overflow-y: auto;
7
- padding: 10px;
8
- display: flex;
9
- flex-direction: column;
10
- }
11
-
12
- .message {
13
- margin-bottom: 10px;
14
- display: flex;
15
- align-items: center;
16
- }
17
-
18
- .message.user {
19
- justify-content: flex-end;
20
- }
21
-
22
- .message.bot {
23
- justify-content: flex-start;
24
- }
25
-
26
- .message .text {
27
- background-color: #ffffff;
28
- border-radius: 10px;
29
- padding: 10px;
30
- max-width: 80%;
31
- line-height: 1.4;
32
- }
33
-
34
- .message.user .text {
35
- background-color: #dcf8c6;
36
- }
37
-
38
- .message.bot .text {
39
- background-color: #ffffff;
40
- }
41
-
42
- .message .timestamp {
43
- font-size: 0.8em;
44
- color: #999;
45
- }
46
-
47
- #input-box {
48
- margin-top: 10px;
49
- display: flex;
50
- }
51
-
52
- #input-box textarea {
53
- width: 80%;
54
- border: 1px solid #ccc;
55
- border-radius: 5px;
56
- padding: 10px;
57
- resize: none;
58
- }
59
-
60
- #input-box button {
61
- width: 20%;
62
- border: none;
63
- border-radius: 5px;
64
- background-color: #007bff;
65
- color: white;
66
- cursor: pointer;
67
- padding: 10px;
68
- }