Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,21 +42,16 @@ def generate(
|
|
| 42 |
input=None,
|
| 43 |
temperature=0.1,
|
| 44 |
top_p=0.95,
|
| 45 |
-
top_k=40,
|
| 46 |
-
stream=True):
|
| 47 |
result = ""
|
| 48 |
if input:
|
| 49 |
instruction = ins_inp.format(instruction, input)
|
| 50 |
else:
|
| 51 |
instruction = ins.format(instruction)
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
else:
|
| 57 |
-
for x in llm(instruction, stop=['### Instruction:', '### End'], temperature=temperature, top_p=top_p, top_k=top_k):
|
| 58 |
-
result += x['choices'][0]['text']
|
| 59 |
-
return result
|
| 60 |
|
| 61 |
|
| 62 |
examples = [
|
|
@@ -145,7 +140,6 @@ with gr.Blocks(theme=seafoam, analytics_enabled=False, css=css) as demo:
|
|
| 145 |
temperature = gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Temperature")
|
| 146 |
top_p = gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p")
|
| 147 |
top_k = gr.components.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k")
|
| 148 |
-
stream = gr.Checkbox(value=True, label="Stream", info="Stream")
|
| 149 |
|
| 150 |
|
| 151 |
with gr.Box():
|
|
@@ -162,7 +156,7 @@ with gr.Blocks(theme=seafoam, analytics_enabled=False, css=css) as demo:
|
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
-
submit.click(generate, inputs=[instruction, input, temperature, top_p, top_k
|
| 166 |
instruction.submit(generate, inputs=[instruction], outputs=[output])
|
| 167 |
|
| 168 |
demo.queue(concurrency_count=1).launch(debug=True)
|
|
|
|
| 42 |
input=None,
|
| 43 |
temperature=0.1,
|
| 44 |
top_p=0.95,
|
| 45 |
+
top_k=40,):
|
|
|
|
| 46 |
result = ""
|
| 47 |
if input:
|
| 48 |
instruction = ins_inp.format(instruction, input)
|
| 49 |
else:
|
| 50 |
instruction = ins.format(instruction)
|
| 51 |
+
for x in llm(instruction, stop=['### Instruction:', '### End'], stream=True, temperature=temperature, top_p=top_p, top_k=top_k):
|
| 52 |
+
result += x['choices'][0]['text']
|
| 53 |
+
yield result
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
|
| 57 |
examples = [
|
|
|
|
| 140 |
temperature = gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Temperature")
|
| 141 |
top_p = gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p")
|
| 142 |
top_k = gr.components.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k")
|
|
|
|
| 143 |
|
| 144 |
|
| 145 |
with gr.Box():
|
|
|
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
+
submit.click(generate, inputs=[instruction, input, temperature, top_p, top_k], outputs=[output])
|
| 160 |
instruction.submit(generate, inputs=[instruction], outputs=[output])
|
| 161 |
|
| 162 |
demo.queue(concurrency_count=1).launch(debug=True)
|