faizah2512 commited on
Commit
92a2ce4
·
verified ·
1 Parent(s): b665204

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -19
app.py CHANGED
@@ -3,7 +3,6 @@ from huggingface_hub import InferenceClient
3
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
6
-
7
  def respond(
8
  message,
9
  history: list[tuple[str, str]],
@@ -36,26 +35,62 @@ def respond(
36
  response += token
37
  yield response
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  """
40
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
41
- """
42
- demo = gr.ChatInterface(
43
- respond,
44
- additional_inputs=[
45
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
46
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
47
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
48
- gr.Slider(
49
- minimum=0.1,
50
- maximum=1.0,
51
- value=0.95,
52
- step=0.05,
53
- label="Top-p (nucleus sampling)",
54
- ),
55
- ],
56
- )
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  if __name__ == "__main__":
60
  demo.launch()
61
-
 
3
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
 
6
  def respond(
7
  message,
8
  history: list[tuple[str, str]],
 
35
  response += token
36
  yield response
37
 
38
+ css = """
39
+ /* Customize the background color and text color */
40
+ body {
41
+ background-color: #f0f0f0;
42
+ color: #333333;
43
+ }
44
+
45
+ /* Customize the chat window */
46
+ .gradio-chatbox {
47
+ border: 1px solid #dddddd;
48
+ background-color: #ffffff;
49
+ border-radius: 10px;
50
+ }
51
+
52
+ /* Customize the user input and response */
53
+ .gradio-chat-message-user {
54
+ background-color: #e1f5fe;
55
+ color: #01579b;
56
+ }
57
+
58
+ .gradio-chat-message-assistant {
59
+ background-color: #fff3e0;
60
+ color: #ef6c00;
61
+ }
62
+
63
+ /* Customize the sliders and text boxes */
64
+ .gradio-input {
65
+ background-color: #ffffff;
66
+ border: 1px solid #dddddd;
67
+ border-radius: 5px;
68
+ padding: 5px;
69
+ color: #333333;
70
+ }
71
+
72
+ .gradio-slider {
73
+ color: #01579b;
74
+ }
75
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
+ with gr.Blocks(css=css) as demo:
78
+ chat_interface = gr.ChatInterface(
79
+ respond,
80
+ additional_inputs=[
81
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
82
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
83
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
84
+ gr.Slider(
85
+ minimum=0.1,
86
+ maximum=1.0,
87
+ value=0.95,
88
+ step=0.05,
89
+ label="Top-p (nucleus sampling)",
90
+ ),
91
+ ],
92
+ theme="default",
93
+ )
94
 
95
  if __name__ == "__main__":
96
  demo.launch()