Spaces:
Running
Running
mrbeliever
commited on
Commit
•
763bcbd
1
Parent(s):
77a68fa
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def format_prompt(message, history):
|
|
18 |
return prompt
|
19 |
|
20 |
def generate(
|
21 |
-
prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
22 |
):
|
23 |
temperature = float(temperature)
|
24 |
if temperature < 1e-2:
|
@@ -44,48 +44,14 @@ def generate(
|
|
44 |
yield output
|
45 |
return output
|
46 |
|
47 |
-
|
48 |
-
gr.Slider(
|
49 |
-
label="Temperature",
|
50 |
-
value=0.9,
|
51 |
-
minimum=0.0,
|
52 |
-
maximum=1.0,
|
53 |
-
step=0.05,
|
54 |
-
interactive=True,
|
55 |
-
info="Higher values produce more diverse outputs",
|
56 |
-
),
|
57 |
-
gr.Slider(
|
58 |
-
label="Max new tokens",
|
59 |
-
value=256,
|
60 |
-
minimum=0,
|
61 |
-
maximum=1048,
|
62 |
-
step=64,
|
63 |
-
interactive=True,
|
64 |
-
info="The maximum numbers of new tokens",
|
65 |
-
),
|
66 |
-
gr.Slider(
|
67 |
-
label="Top-p (nucleus sampling)",
|
68 |
-
value=0.90,
|
69 |
-
minimum=0.0,
|
70 |
-
maximum=1,
|
71 |
-
step=0.05,
|
72 |
-
interactive=True,
|
73 |
-
info="Higher values sample more low-probability tokens",
|
74 |
-
),
|
75 |
-
gr.Slider(
|
76 |
-
label="Repetition penalty",
|
77 |
-
value=1.2,
|
78 |
-
minimum=1.0,
|
79 |
-
maximum=2.0,
|
80 |
-
step=0.05,
|
81 |
-
interactive=True,
|
82 |
-
info="Penalize repeated tokens",
|
83 |
-
)
|
84 |
-
]
|
85 |
-
|
86 |
-
gr.ChatInterface(
|
87 |
fn=generate,
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
18 |
return prompt
|
19 |
|
20 |
def generate(
|
21 |
+
prompt, history=[], temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
22 |
):
|
23 |
temperature = float(temperature)
|
24 |
if temperature < 1e-2:
|
|
|
44 |
yield output
|
45 |
return output
|
46 |
|
47 |
+
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
fn=generate,
|
49 |
+
inputs=[
|
50 |
+
gr.Textbox(placeholder="Enter your prompt here...", lines=2, max_lines=2, label=""),
|
51 |
+
gr.Button("Generate")
|
52 |
+
],
|
53 |
+
outputs=gr.Textbox(label="Output", interactive=True, lines=10),
|
54 |
+
layout="vertical"
|
55 |
+
)
|
56 |
+
|
57 |
+
iface.launch()
|