Update app.py
Browse files
app.py
CHANGED
|
@@ -129,6 +129,55 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 129 |
if __name__ == "__main__":
|
| 130 |
demo.queue(max_size=20).launch(share=True)
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
|
|
|
|
| 129 |
if __name__ == "__main__":
|
| 130 |
demo.queue(max_size=20).launch(share=True)
|
| 131 |
|
| 132 |
+
gr.ChatInterface(
|
| 133 |
+
fn=generate,
|
| 134 |
+
additional_inputs=[
|
| 135 |
+
gr.Slider(
|
| 136 |
+
label="Max new tokens",
|
| 137 |
+
minimum=1,
|
| 138 |
+
maximum=MAX_MAX_NEW_TOKENS,
|
| 139 |
+
step=1,
|
| 140 |
+
value=DEFAULT_MAX_NEW_TOKENS,
|
| 141 |
+
),
|
| 142 |
+
gr.Slider(
|
| 143 |
+
label="Temperature",
|
| 144 |
+
minimum=0.1,
|
| 145 |
+
maximum=4.0,
|
| 146 |
+
step=0.1,
|
| 147 |
+
value=0.6,
|
| 148 |
+
),
|
| 149 |
+
gr.Slider(
|
| 150 |
+
label="Top-p (nucleus sampling)",
|
| 151 |
+
minimum=0.05,
|
| 152 |
+
maximum=1.0,
|
| 153 |
+
step=0.05,
|
| 154 |
+
value=0.9,
|
| 155 |
+
),
|
| 156 |
+
gr.Slider(
|
| 157 |
+
label="Top-k",
|
| 158 |
+
minimum=1,
|
| 159 |
+
maximum=1000,
|
| 160 |
+
step=1,
|
| 161 |
+
value=50,
|
| 162 |
+
),
|
| 163 |
+
gr.Slider(
|
| 164 |
+
label="Repetition penalty",
|
| 165 |
+
minimum=1.0,
|
| 166 |
+
maximum=2.0,
|
| 167 |
+
step=0.05,
|
| 168 |
+
value=1.2,
|
| 169 |
+
),
|
| 170 |
+
],
|
| 171 |
+
stop_btn=None,
|
| 172 |
+
examples=[
|
| 173 |
+
["Hello there! How are you doing?"],
|
| 174 |
+
["Can you explain briefly to me what is the Python programming language?"],
|
| 175 |
+
["Explain the plot of Cinderella in a sentence."],
|
| 176 |
+
["How many hours does it take a man to eat a Helicopter?"],
|
| 177 |
+
["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
|
| 178 |
+
],
|
| 179 |
+
).launch(share=True)
|
| 180 |
+
|
| 181 |
|
| 182 |
|
| 183 |
|