ehristoforu commited on
Commit
fa4fc82
1 Parent(s): 7e52021

Update app (15).py

Browse files
Files changed (1) hide show
  1. app (15).py +24 -53
app (15).py CHANGED
@@ -258,76 +258,42 @@ def retry_last_answer(
258
  do_save,
259
  )
260
 
261
-
262
- title = """<h1 align="center">⭐ StarChat Playground 💬</h1>"""
263
- custom_css = """
264
- #banner-image {
265
- display: block;
266
- margin-left: auto;
267
- margin-right: auto;
268
- }
269
-
270
- #chat-message {
271
- font-size: 14px;
272
- min-height: 300px;
273
- }
274
- """
275
-
276
- with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
277
- gr.HTML(title)
278
 
279
  with gr.Row():
280
  with gr.Column():
281
- gr.Image("thumbnail.png", elem_id="banner-image", show_label=False)
282
- with gr.Column():
283
- gr.Markdown(
284
- """
285
- 💻 This demo showcases a series of **[StarChat](https://huggingface.co/models?search=huggingfaceh4/starchat)** language models, which are fine-tuned versions of the StarCoder family to act as helpful coding assistants. The base model has 16B parameters and was pretrained on one trillion tokens sourced from 80+ programming languages, GitHub issues, Git commits, and Jupyter notebooks (all permissively licensed).
286
-
287
- 📝 For more details, check out our [blog post](https://huggingface.co/blog/starchat-alpha).
288
-
289
- ⚠️ **Intended Use**: this app and its [supporting models](https://huggingface.co/models?search=huggingfaceh4/starchat) are provided as educational tools to explain large language model fine-tuning; not to serve as replacement for human expertise.
290
-
291
- ⚠️ **Known Failure Modes**: the alpha and beta version of **StarChat** have not been aligned to human preferences with techniques like RLHF, so they can produce problematic outputs (especially when prompted to do so). Since the base model was pretrained on a large corpus of code, it may produce code snippets that are syntactically valid but semantically incorrect. For example, it may produce code that does not compile or that produces incorrect results. It may also produce code that is vulnerable to security exploits. We have observed the model also has a tendency to produce false URLs which should be carefully inspected before clicking. For more details on the model's limitations in terms of factuality and biases, see the [model card](https://huggingface.co/HuggingFaceH4/starchat-alpha#bias-risks-and-limitations).
292
-
293
- ⚠️ **Data Collection**: by default, we are collecting the prompts entered in this app to further improve and evaluate the models. Do **NOT** share any personal or sensitive information while using the app! You can opt out of this data collection by removing the checkbox below.
294
- """
295
- )
296
-
297
  with gr.Row():
298
- do_save = gr.Checkbox(
299
- value=True,
300
- label="Store data",
301
- info="You agree to the storage of your prompt and generated text for research and development purposes:",
302
- )
303
-
304
  with gr.Row():
305
- selected_model = gr.Radio(choices=model_names, value=model_names[1], label="Select a model")
306
-
307
- with gr.Accordion(label="System Prompt", open=False, elem_id="parameters-accordion"):
308
- system_message = gr.Textbox(
309
- elem_id="system-message",
310
- placeholder="Below is a conversation between a human user and a helpful AI coding assistant.",
311
- show_label=False,
312
- )
313
  with gr.Row():
314
  with gr.Box():
315
  output = gr.Markdown()
316
- chatbot = gr.Chatbot(elem_id="chat-message", label="Chat")
317
 
318
  with gr.Row():
319
  with gr.Column(scale=3):
320
- user_message = gr.Textbox(placeholder="Enter your message here", show_label=False, elem_id="q-input")
321
  with gr.Row():
322
- send_button = gr.Button("Send", elem_id="send-btn", visible=True)
323
 
324
- regenerate_button = gr.Button("Regenerate", elem_id="retry-btn", visible=True)
325
 
326
- delete_turn_button = gr.Button("Delete last turn", elem_id="delete-btn", visible=True)
327
 
328
- clear_chat_button = gr.Button("Clear chat", elem_id="clear-btn", visible=True)
329
 
330
  with gr.Accordion(label="Parameters", open=False, elem_id="parameters-accordion"):
 
 
 
 
 
 
331
  temperature = gr.Slider(
332
  label="Temperature",
333
  value=0.2,
@@ -373,6 +339,11 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
373
  interactive=True,
374
  info="The parameter for repetition penalty. 1.0 means no penalty.",
375
  )
 
 
 
 
 
376
  # with gr.Group(elem_id="share-btn-container"):
377
  # community_icon = gr.HTML(community_icon_html, visible=True)
378
  # loading_icon = gr.HTML(loading_icon_html, visible=True)
 
258
  do_save,
259
  )
260
 
261
+ with gr.Blocks(analytics_enabled=False, css="style.css") as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
  with gr.Row():
264
  with gr.Column():
265
+ gr.Image("StarChat_logo.png", elem_id="banner-image", show_label=False, show_share_btn=False, show_download_btn=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  with gr.Row():
267
+ with gr.Column():
268
+ gr.DuplicateButton(value='Duplicate Space for private use',
269
+ elem_id='duplicate-button')
 
 
 
270
  with gr.Row():
271
+ selected_model = gr.Radio(choices=model_names, value=model_names[0], label="Current Model", interactive=False)
272
+
 
 
 
 
 
 
273
  with gr.Row():
274
  with gr.Box():
275
  output = gr.Markdown()
276
+ chatbot = gr.Chatbot(elem_id="chat-message", label="Playground")
277
 
278
  with gr.Row():
279
  with gr.Column(scale=3):
280
+ user_message = gr.Textbox(placeholder="Enter your message here", show_label=False, elem_id="q-input", lines=2)
281
  with gr.Row():
282
+ send_button = gr.Button("▶️ Send", elem_id="send-btn", visible=True)
283
 
284
+ regenerate_button = gr.Button("🔄 Regenerate", elem_id="retry-btn", visible=True)
285
 
286
+ delete_turn_button = gr.Button("↩️ Delete last turn", elem_id="delete-btn", visible=True)
287
 
288
+ clear_chat_button = gr.Button("🗑 Clear chat", elem_id="clear-btn", visible=True)
289
 
290
  with gr.Accordion(label="Parameters", open=False, elem_id="parameters-accordion"):
291
+ system_message = gr.Textbox(
292
+ elem_id="system-message",
293
+ placeholder="Below is a conversation between a human user and a helpful AI coding assistant.",
294
+ label="System Prompt",
295
+ lines=2,
296
+ )
297
  temperature = gr.Slider(
298
  label="Temperature",
299
  value=0.2,
 
339
  interactive=True,
340
  info="The parameter for repetition penalty. 1.0 means no penalty.",
341
  )
342
+ do_save = gr.Checkbox(
343
+ value=True,
344
+ label="Store data",
345
+ info="You agree to the storage of your prompt and generated text for research and development purposes:",
346
+ )
347
  # with gr.Group(elem_id="share-btn-container"):
348
  # community_icon = gr.HTML(community_icon_html, visible=True)
349
  # loading_icon = gr.HTML(loading_icon_html, visible=True)