Smiley0707 commited on
Commit
0627aad
1 Parent(s): b014a13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -1
app.py CHANGED
@@ -31,7 +31,7 @@ h3 {
31
  }
32
  """
33
 
34
- device = "cuda"
35
 
36
  quantization_config = BitsAndBytesConfig(
37
  load_in_4bit=True,
@@ -101,10 +101,65 @@ chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
101
 
102
  with gr.Blocks(css=CSS, theme="soft") as demo:
103
  gr.HTML(TITLE)
 
104
  gr.ChatInterface(
105
  fn=stream_chat,
106
  chatbot=chatbot,
107
  fill_height=True,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  cache_examples=False,
109
  )
110
 
 
31
  }
32
  """
33
 
34
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
35
 
36
  quantization_config = BitsAndBytesConfig(
37
  load_in_4bit=True,
 
101
 
102
  with gr.Blocks(css=CSS, theme="soft") as demo:
103
  gr.HTML(TITLE)
104
+ gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button")
105
  gr.ChatInterface(
106
  fn=stream_chat,
107
  chatbot=chatbot,
108
  fill_height=True,
109
+ additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
110
+ additional_inputs=[
111
+ gr.Textbox(
112
+ value="You are a helpful assistant",
113
+ label="System Prompt",
114
+ render=False,
115
+ ),
116
+ gr.Slider(
117
+ minimum=0,
118
+ maximum=1,
119
+ step=0.1,
120
+ value=0.8,
121
+ label="Temperature",
122
+ render=False,
123
+ ),
124
+ gr.Slider(
125
+ minimum=128,
126
+ maximum=8192,
127
+ step=1,
128
+ value=1024,
129
+ label="Max new tokens",
130
+ render=False,
131
+ ),
132
+ gr.Slider(
133
+ minimum=0.0,
134
+ maximum=1.0,
135
+ step=0.1,
136
+ value=1.0,
137
+ label="top_p",
138
+ render=False,
139
+ ),
140
+ gr.Slider(
141
+ minimum=1,
142
+ maximum=20,
143
+ step=1,
144
+ value=20,
145
+ label="top_k",
146
+ render=False,
147
+ ),
148
+ gr.Slider(
149
+ minimum=0.0,
150
+ maximum=2.0,
151
+ step=0.1,
152
+ value=1.2,
153
+ label="Repetition penalty",
154
+ render=False,
155
+ ),
156
+ ],
157
+ examples=[
158
+ ["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
159
+ ["What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."],
160
+ ["Tell me a random fun fact about the Roman Empire."],
161
+ ["Show me a code snippet of a website's sticky header in CSS and JavaScript."],
162
+ ],
163
  cache_examples=False,
164
  )
165