Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,6 @@ def respond(
|
|
| 98 |
yield f"Error: {str(e)}"
|
| 99 |
|
| 100 |
with gr.Blocks() as demo:
|
| 101 |
-
# First, define all input components we'll need
|
| 102 |
with gr.Row():
|
| 103 |
with gr.Column():
|
| 104 |
model_dropdown = gr.Dropdown(
|
|
@@ -111,42 +110,36 @@ with gr.Blocks() as demo:
|
|
| 111 |
value=list(PROMPT_STRATEGIES.keys())[0],
|
| 112 |
label="Select Prompt Strategy"
|
| 113 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
)
|
| 139 |
-
|
| 140 |
-
top_p = gr.Slider(
|
| 141 |
-
minimum=0.1,
|
| 142 |
-
maximum=1.0,
|
| 143 |
-
value=0.95,
|
| 144 |
-
step=0.05,
|
| 145 |
-
label="Top-p (nucleus sampling)",
|
| 146 |
-
visible=False
|
| 147 |
-
)
|
| 148 |
-
|
| 149 |
-
# Now we can use all components in ChatInterface
|
| 150 |
chatbot = gr.ChatInterface(
|
| 151 |
fn=respond,
|
| 152 |
additional_inputs=[
|
|
@@ -161,16 +154,6 @@ with gr.Blocks() as demo:
|
|
| 161 |
|
| 162 |
# Parameters and Prompt Details section below the chat
|
| 163 |
with gr.Row():
|
| 164 |
-
with gr.Column():
|
| 165 |
-
# Parameter Controls in Accordion
|
| 166 |
-
with gr.Accordion("Generation Parameters", open=False):
|
| 167 |
-
override_params.visible = True
|
| 168 |
-
|
| 169 |
-
with gr.Column(visible=False) as param_controls:
|
| 170 |
-
max_tokens.visible = True
|
| 171 |
-
temperature.visible = True
|
| 172 |
-
top_p.visible = True
|
| 173 |
-
|
| 174 |
with gr.Column():
|
| 175 |
with gr.Accordion("Current Prompt Details", open=False):
|
| 176 |
system_prompt_display = gr.TextArea(
|
|
|
|
| 98 |
yield f"Error: {str(e)}"
|
| 99 |
|
| 100 |
with gr.Blocks() as demo:
|
|
|
|
| 101 |
with gr.Row():
|
| 102 |
with gr.Column():
|
| 103 |
model_dropdown = gr.Dropdown(
|
|
|
|
| 110 |
value=list(PROMPT_STRATEGIES.keys())[0],
|
| 111 |
label="Select Prompt Strategy"
|
| 112 |
)
|
| 113 |
+
|
| 114 |
+
with gr.Row():
|
| 115 |
+
override_params = gr.Checkbox(
|
| 116 |
+
label="Override Template Parameters",
|
| 117 |
+
value=False
|
| 118 |
+
)
|
| 119 |
|
| 120 |
+
with gr.Row():
|
| 121 |
+
with gr.Column(visible=False) as param_controls:
|
| 122 |
+
max_tokens = gr.Slider(
|
| 123 |
+
minimum=1,
|
| 124 |
+
maximum=2048,
|
| 125 |
+
value=512,
|
| 126 |
+
step=1,
|
| 127 |
+
label="Max new tokens"
|
| 128 |
+
)
|
| 129 |
+
temperature = gr.Slider(
|
| 130 |
+
minimum=0.1,
|
| 131 |
+
maximum=4.0,
|
| 132 |
+
value=0.7,
|
| 133 |
+
step=0.1,
|
| 134 |
+
label="Temperature"
|
| 135 |
+
)
|
| 136 |
+
top_p = gr.Slider(
|
| 137 |
+
minimum=0.1,
|
| 138 |
+
maximum=1.0,
|
| 139 |
+
value=0.95,
|
| 140 |
+
step=0.05,
|
| 141 |
+
label="Top-p (nucleus sampling)"
|
| 142 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
chatbot = gr.ChatInterface(
|
| 144 |
fn=respond,
|
| 145 |
additional_inputs=[
|
|
|
|
| 154 |
|
| 155 |
# Parameters and Prompt Details section below the chat
|
| 156 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
with gr.Column():
|
| 158 |
with gr.Accordion("Current Prompt Details", open=False):
|
| 159 |
system_prompt_display = gr.TextArea(
|