Spaces:
Sleeping
Sleeping
fix top_k is not a number error
Browse files
app.py
CHANGED
|
@@ -12,16 +12,17 @@ description = """
|
|
| 12 |
|
| 13 |
prompt = 'Write a story. In the story, try to use the verb "fight", the noun "king" and the adjective "brave". Possible story:'
|
| 14 |
|
| 15 |
-
def generate_text(input_prompt=
|
| 16 |
return client.text_generation(input_prompt, do_sample=True, max_new_tokens=max_len, temperature=temp, top_k=top_k)
|
| 17 |
|
| 18 |
|
| 19 |
inputs = [
|
| 20 |
gr.Textbox(prompt, label="Prompt text"),
|
| 21 |
gr.Slider(minimum=50, maximum=250, step=50, label="max-lenth generation", value=200),
|
| 22 |
-
gr.Slider(0
|
| 23 |
-
gr.Textbox(label="top-k", value=10,),
|
| 24 |
gr.Slider(minimum=0.0, maximum=4.0, step=0.1, label="temperature", value=0.5),
|
|
|
|
|
|
|
| 25 |
]
|
| 26 |
outputs = [gr.Textbox(label="Generated Text")]
|
| 27 |
|
|
|
|
| 12 |
|
| 13 |
prompt = 'Write a story. In the story, try to use the verb "fight", the noun "king" and the adjective "brave". Possible story:'
|
| 14 |
|
| 15 |
+
def generate_text(input_prompt=prompt, max_len=200, top_k=10, temp=0.5, top_p=0.95):
|
| 16 |
return client.text_generation(input_prompt, do_sample=True, max_new_tokens=max_len, temperature=temp, top_k=top_k)
|
| 17 |
|
| 18 |
|
| 19 |
inputs = [
|
| 20 |
gr.Textbox(prompt, label="Prompt text"),
|
| 21 |
gr.Slider(minimum=50, maximum=250, step=50, label="max-lenth generation", value=200),
|
| 22 |
+
gr.Slider(minimum=0, maximum=20, step=1, label="top-k", value=10),
|
|
|
|
| 23 |
gr.Slider(minimum=0.0, maximum=4.0, step=0.1, label="temperature", value=0.5),
|
| 24 |
+
gr.Slider(0.0, 1.0, label="top-p", value=0.95),
|
| 25 |
+
#gr.Textbox(label="top-k", value=10,),
|
| 26 |
]
|
| 27 |
outputs = [gr.Textbox(label="Generated Text")]
|
| 28 |
|