ffreemt commited on
Commit
f7df7de
1 Parent(s): 107a43e

Update example inputs

Browse files
Files changed (1) hide show
  1. app.py +54 -8
app.py CHANGED
@@ -71,7 +71,7 @@ def format_prompt(system_prompt: str, user_prompt: str):
71
 
72
  system_prompt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n"
73
  user_prompt = f"<|im_start|>user\n{user_prompt}<|im_end|>\n"
74
- assistant_prompt = f"<|im_start|>assistant\n"
75
 
76
  return f"{system_prompt}{user_prompt}{assistant_prompt}"
77
 
@@ -248,32 +248,42 @@ generation_config = GenerationConfig(
248
  user_prefix = "[user]: "
249
  assistant_prefix = "[assistant]: "
250
 
 
251
  css = """
 
 
 
 
 
 
 
 
252
  .disclaimer {font-variant-caps: all-small-caps; font-size: xx-small;}
253
  .intro {font-size: x-small;}
254
  """
255
 
256
  with gr.Blocks(
257
- theme=gr.themes.Soft(),
 
258
  css=css,
259
- ) as demo:
260
  with gr.Accordion("🎈 Info", open=False):
261
  gr.Markdown(
262
- """<h4><center>mosaicml mpt-30b-chat</center></h4>
263
 
264
  This demo is of [TheBloke/mpt-30B-chat-GGML](TheBloke/mpt-30B-chat-GGML.)
265
 
266
- It takes about >40 seconds to get a response.
267
  """,
268
  elem_classes="intro"
269
  )
270
  conversation = Chat()
271
- chatbot = gr.Chatbot().style(height=500) # 500
272
  with gr.Row():
273
  with gr.Column():
274
  msg = gr.Textbox(
275
  label="Chat Message Box",
276
- placeholder="Chat Message Box",
277
  show_label=False,
278
  ).style(container=False)
279
  with gr.Column():
@@ -294,6 +304,42 @@ with gr.Blocks(
294
  with gr.Row():
295
  change = gr.Button("Change System Prompt")
296
  reset = gr.Button("Reset System Prompt")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  # with gr.Row():
298
  with gr.Accordion("Disclaimer", open=False):
299
  gr.Markdown(
@@ -378,4 +424,4 @@ with gr.Blocks(
378
  show_progress="full",
379
  )
380
 
381
- demo.queue(max_size=36, concurrency_count=14).launch(debug=True)
 
71
 
72
  system_prompt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n"
73
  user_prompt = f"<|im_start|>user\n{user_prompt}<|im_end|>\n"
74
+ assistant_prompt = "<|im_start|>assistant\n"
75
 
76
  return f"{system_prompt}{user_prompt}{assistant_prompt}"
77
 
 
248
  user_prefix = "[user]: "
249
  assistant_prefix = "[assistant]: "
250
 
251
+
252
  css = """
253
+ .importantButton {
254
+ background: linear-gradient(45deg, #7e0570,#5d1c99, #6e00ff) !important;
255
+ border: none !important;
256
+ }
257
+ .importantButton:hover {
258
+ background: linear-gradient(45deg, #ff00e0,#8500ff, #6e00ff) !important;
259
+ border: none !important;
260
+ }
261
  .disclaimer {font-variant-caps: all-small-caps; font-size: xx-small;}
262
  .intro {font-size: x-small;}
263
  """
264
 
265
  with gr.Blocks(
266
+ title="mpt-30b-ggml-chat",
267
+ theme=gr.themes.Soft(text_size="sm"),
268
  css=css,
269
+ ) as block:
270
  with gr.Accordion("🎈 Info", open=False):
271
  gr.Markdown(
272
+ """<h4><center>mpt-30b-ggml-chat</center></h4>
273
 
274
  This demo is of [TheBloke/mpt-30B-chat-GGML](TheBloke/mpt-30B-chat-GGML.)
275
 
276
+ It takes about >40 seconds to get a response. Restarting the space takes about 5 minutes if the space is asleep due to inactivity.
277
  """,
278
  elem_classes="intro"
279
  )
280
  conversation = Chat()
281
+ chatbot = gr.Chatbot().style(height=700) # 500
282
  with gr.Row():
283
  with gr.Column():
284
  msg = gr.Textbox(
285
  label="Chat Message Box",
286
+ placeholder="Ask me anything (press Enter or click Submit to send)",
287
  show_label=False,
288
  ).style(container=False)
289
  with gr.Column():
 
304
  with gr.Row():
305
  change = gr.Button("Change System Prompt")
306
  reset = gr.Button("Reset System Prompt")
307
+
308
+ with gr.Accordion("Example inputs", open=True):
309
+ etext = """In America, where cars are an important part of the national psyche, a decade ago people had suddenly started to drive less, which had not happened since the oil shocks of the 1970s. """
310
+ examples = gr.Examples(
311
+ examples=[
312
+ ["Explain the plot of Cinderella in a sentence."],
313
+ [
314
+ "How long does it take to become proficient in French, and what are the best methods for retaining information?"
315
+ ],
316
+ ["What are some common mistakes to avoid when writing code?"],
317
+ ["Build a prompt to generate a beautiful portrait of a horse"],
318
+ ["Suggest four metaphors to describe the benefits of AI"],
319
+ ["Write a pop song about leaving home for the sandy beaches."],
320
+ ["Write a summary demonstrating my ability to tame lions"],
321
+ ["鲁迅和周树人什么关系"],
322
+ ["从前有一头牛,这头牛后面有什么?"],
323
+ ["正无穷大加一大于正无穷大吗?"],
324
+ ["正无穷大加正无穷大大于正无穷大吗?"],
325
+ ["-2的平方根等于什么"],
326
+ ["树上有5只鸟,猎人开枪打死了一只。树上还有几只鸟?"],
327
+ ["树上有11只鸟,猎人开枪打死了一只。树上还有几只鸟?提示:需考虑鸟可能受惊吓飞走。"],
328
+ ["鲁迅和周树人什么关系 用英文回答"],
329
+ ["以红楼梦的行文风格写一张委婉的请假条。不少于320字。"],
330
+ [f"{etext} 翻成中文,列出3个版本"],
331
+ [f"{etext} \n 翻成中文,保留原意,但使用文学性的语言。不要写解释。列出3个版本"],
332
+ ["js 判断一个数是不是质数"],
333
+ ["js 实现python 的 range(10)"],
334
+ ["js 实现python 的 [*(range(10)]"],
335
+ ["假定 1 + 2 = 4, 试求 7 + 8"],
336
+ ["Erkläre die Handlung von Cinderella in einem Satz."],
337
+ ["Erkläre die Handlung von Cinderella in einem Satz. Auf Deutsch"],
338
+ ],
339
+ inputs=[msg],
340
+ examples_per_page=30,
341
+ )
342
+
343
  # with gr.Row():
344
  with gr.Accordion("Disclaimer", open=False):
345
  gr.Markdown(
 
424
  show_progress="full",
425
  )
426
 
427
+ block.queue(max_size=36, concurrency_count=14).launch(debug=True)