Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,8 @@ def chat_stream(
|
|
22 |
instruction,
|
23 |
state_chatbot,
|
24 |
):
|
25 |
-
|
|
|
26 |
|
27 |
# user input should be appropriately formatted (don't be confused by the function name)
|
28 |
instruction_display = common_post_process(instruction)
|
@@ -132,15 +133,28 @@ with gr.Blocks(css=PARENT_BLOCK_CSS) as demo:
|
|
132 |
summarize_btn = gr.Button(value="Summarize")
|
133 |
|
134 |
gr.Markdown("#### Examples")
|
135 |
-
for
|
136 |
-
with gr.Accordion(
|
137 |
-
|
138 |
-
examples
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
gr.Markdown(f"{BOTTOM_LINE}")
|
146 |
|
|
|
22 |
instruction,
|
23 |
state_chatbot,
|
24 |
):
|
25 |
+
if len(context) > 150 or len(instruction) > 150:
|
26 |
+
raise gr.Error("context or prompt is too long!")
|
27 |
|
28 |
# user input should be appropriately formatted (don't be confused by the function name)
|
29 |
instruction_display = common_post_process(instruction)
|
|
|
133 |
summarize_btn = gr.Button(value="Summarize")
|
134 |
|
135 |
gr.Markdown("#### Examples")
|
136 |
+
for _, (category, examples) in enumerate(DEFAULT_EXAMPLES.items()):
|
137 |
+
with gr.Accordion(category, open=False):
|
138 |
+
if category == "Identity":
|
139 |
+
for item in examples:
|
140 |
+
with gr.Accordion(item["title"], open=False):
|
141 |
+
gr.Examples(
|
142 |
+
examples=item["examples"],
|
143 |
+
inputs=[
|
144 |
+
hidden_txtbox, context_txtbox, instruction_txtbox
|
145 |
+
],
|
146 |
+
label=None
|
147 |
+
)
|
148 |
+
else:
|
149 |
+
for item in examples:
|
150 |
+
with gr.Accordion(item["title"], open=False):
|
151 |
+
gr.Examples(
|
152 |
+
examples=item["examples"],
|
153 |
+
inputs=[
|
154 |
+
hidden_txtbox, instruction_txtbox
|
155 |
+
],
|
156 |
+
label=None
|
157 |
+
)
|
158 |
|
159 |
gr.Markdown(f"{BOTTOM_LINE}")
|
160 |
|