Spaces:
Runtime error
Runtime error
xlr8harder
commited on
Commit
•
8486464
1
Parent(s):
450c82c
Minor tweaks.
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def generate_completion(prompt, temperature, repetition_penalty, stop_phrase):
|
|
18 |
prompt=prompt,
|
19 |
temperature=temperature,
|
20 |
frequency_penalty=repetition_penalty,
|
21 |
-
max_tokens=
|
22 |
stop=[stop_phrase] if stop_phrase else None
|
23 |
)
|
24 |
return completion.choices[0].text.strip()
|
@@ -26,7 +26,7 @@ def generate_completion(prompt, temperature, repetition_penalty, stop_phrase):
|
|
26 |
return f"An error occurred: {str(e)}"
|
27 |
|
28 |
def append_completion(prompt, completion):
|
29 |
-
new_prompt = f"{prompt}
|
30 |
return new_prompt, "" # Return new prompt and empty completion
|
31 |
|
32 |
def clear_fields():
|
@@ -37,7 +37,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
37 |
|
38 |
with gr.Row():
|
39 |
with gr.Column(scale=2):
|
40 |
-
prompt_input = gr.Textbox(label="Prompt", lines=
|
41 |
with gr.Column(scale=1):
|
42 |
temperature_slider = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Temperature")
|
43 |
repetition_penalty_slider = gr.Slider(minimum=0, maximum=2, value=1.1, step=0.1, label="Repetition Penalty")
|
|
|
18 |
prompt=prompt,
|
19 |
temperature=temperature,
|
20 |
frequency_penalty=repetition_penalty,
|
21 |
+
max_tokens=500,
|
22 |
stop=[stop_phrase] if stop_phrase else None
|
23 |
)
|
24 |
return completion.choices[0].text.strip()
|
|
|
26 |
return f"An error occurred: {str(e)}"
|
27 |
|
28 |
def append_completion(prompt, completion):
|
29 |
+
new_prompt = f"{prompt}{completion}".strip()
|
30 |
return new_prompt, "" # Return new prompt and empty completion
|
31 |
|
32 |
def clear_fields():
|
|
|
37 |
|
38 |
with gr.Row():
|
39 |
with gr.Column(scale=2):
|
40 |
+
prompt_input = gr.Textbox(label="Prompt", lines=6, value="The best thing about being a cat is")
|
41 |
with gr.Column(scale=1):
|
42 |
temperature_slider = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Temperature")
|
43 |
repetition_penalty_slider = gr.Slider(minimum=0, maximum=2, value=1.1, step=0.1, label="Repetition Penalty")
|