faizah2512 commited on
Commit
78e9541
·
verified ·
1 Parent(s): 72b515c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -54
app.py CHANGED
@@ -3,6 +3,7 @@ from huggingface_hub import InferenceClient
3
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
 
6
  def respond(
7
  message,
8
  history: list[tuple[str, str]],
@@ -35,62 +36,23 @@ def respond(
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()
 
3
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
6
+
7
  def respond(
8
  message,
9
  history: list[tuple[str, str]],
 
36
  response += token
37
  yield response
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
+ demo = gr.ChatInterface(
41
+ respond,
42
+ additional_inputs=[
43
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
44
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
45
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
46
+ gr.Slider(
47
+ minimum=0.1,
48
+ maximum=1.0,
49
+ value=0.95,
50
+ step=0.05,
51
+ label="Top-p (nucleus sampling)",
52
+ ),
53
+ ],
54
+ )
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  if __name__ == "__main__":
58
  demo.launch()