predatortoabuse
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -205,25 +205,6 @@ top_p_component = gr.Slider(
|
|
205 |
"the next token (using temperature). "
|
206 |
))
|
207 |
|
208 |
-
EXAMPLES = [
|
209 |
-
["What is the capital of France?", None],
|
210 |
-
["How do I optimize my website for better search engine rankings?", None],
|
211 |
-
["Translate 'hello' to Spanish.", None],
|
212 |
-
["Explain the theory of relativity in simple terms.", None],
|
213 |
-
["What are the key differences between capitalism and socialism?", None],
|
214 |
-
["Write a short story about a time-traveling cat.", None]
|
215 |
-
]
|
216 |
-
|
217 |
-
def load_example(example):
|
218 |
-
text_prompt, image_files = example
|
219 |
-
chatbot = [(text_prompt, None)] if text_prompt else []
|
220 |
-
return text_prompt or "", chatbot
|
221 |
-
|
222 |
-
example_inputs = [
|
223 |
-
text_prompt_component,
|
224 |
-
chatbot_component
|
225 |
-
]
|
226 |
-
|
227 |
user_inputs = [
|
228 |
text_prompt_component,
|
229 |
chatbot_component
|
@@ -257,40 +238,29 @@ with gr.Blocks() as demo:
|
|
257 |
top_k_component.render()
|
258 |
top_p_component.render()
|
259 |
|
260 |
-
gr.Examples(
|
261 |
-
examples=EXAMPLES,
|
262 |
-
inputs=example_inputs,
|
263 |
-
fn=load_example,
|
264 |
-
outputs=[text_prompt_component, chatbot_component]
|
265 |
-
)
|
266 |
-
|
267 |
run_button_component.click(
|
268 |
fn=user,
|
269 |
inputs=user_inputs,
|
270 |
-
outputs=[text_prompt_component, chatbot_component],
|
271 |
-
queue=False
|
272 |
-
).then(
|
273 |
-
|
274 |
-
|
275 |
-
outputs=[chatbot_component],
|
276 |
-
)
|
277 |
|
278 |
-
text_prompt_component.submit(
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
).then(
|
284 |
-
|
285 |
-
|
286 |
-
outputs=[chatbot_component],
|
287 |
-
)
|
288 |
|
289 |
-
upload_button_component.upload(
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
)
|
295 |
|
296 |
-
demo.queue(max_size=99).launch(debug=False, show_error=True)
|
|
|
205 |
"the next token (using temperature). "
|
206 |
))
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
user_inputs = [
|
209 |
text_prompt_component,
|
210 |
chatbot_component
|
|
|
238 |
top_k_component.render()
|
239 |
top_p_component.render()
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
run_button_component.click(
|
242 |
fn=user,
|
243 |
inputs=user_inputs,
|
244 |
+
outputs=[text_prompt_component, chatbot_component],
|
245 |
+
queue=False
|
246 |
+
).then(
|
247 |
+
fn=bot, inputs=bot_inputs, outputs=[chatbot_component],
|
248 |
+
)
|
|
|
|
|
249 |
|
250 |
+
text_prompt_component.submit(
|
251 |
+
fn=user,
|
252 |
+
inputs=user_inputs,
|
253 |
+
outputs=[text_prompt_component, chatbot_component],
|
254 |
+
queue=False
|
255 |
+
).then(
|
256 |
+
fn=bot, inputs=bot_inputs, outputs=[chatbot_component],
|
257 |
+
)
|
|
|
|
|
258 |
|
259 |
+
upload_button_component.upload(
|
260 |
+
fn=upload,
|
261 |
+
inputs=[upload_button_component, chatbot_component],
|
262 |
+
outputs=[chatbot_component],
|
263 |
+
queue=False
|
264 |
+
)
|
265 |
|
266 |
+
demo.queue(max_size=99).launch(debug=False, show_error=True)
|