Spaces:
Build error
Build error
Update app.py
Browse files103 unmodified lines10410510610710710810911011111211311416 unmodified lines131132133134135136135136137137138139140141142143139140141142143144145146147144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173149150151152153154155156174157158159160161162163164165166167168169170171172173174175176177175176177103 unmodified lines eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id) result = tokenizer.instruct_tokenizer.tokenizer.decode(out_tokens[0])
for i in range(len(result)): time.sleep(0.05) yield result[: i + 1]
tools_schema = """function_params = {16 unmodified lines },}"""
chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)with gr.Blocks(theme="citrus", css=CSS) as demo: gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button") chatbot = gr.Chatbot( height=600, placeholder=PLACEHOLDER, gr.ChatInterface( fn=stream_chat, title="Mistral-lab", chatbot=chatbot, # type="messages", fill_height=True, examples=[ {'text': "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."}, {'text': "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."}, {'text': "Tell me a random fun fact about the Roman Empire."}, {'text': "Show me a code snippet of a website's sticky header in CSS and JavaScript."}, ] ) msg = gr.Textbox( value = "", label = "Chat" ["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."], ["What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."], ["Tell me a random fun fact about the Roman Empire."], ["Show me a code snippet of a website's sticky header in CSS and JavaScript."], ], cache_examples = False, additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False), additional_inputs=[ gr.Textbox( value = tools_schema, label = "Tools schema", ) gr.Slider( minimum=0, maximum=1, step=0.1, value=0.3, label="Temperature", render=False, ), gr.Slider( minimum=128, maximum=8192, step=1, value=1024, label="Max new tokens", render=False, ), ], ) with gr.Row(): send = gr.Button( value = "Send", size="lg", variant = "primary", ) clear = gr.ClearButton([msg, chatbot])
with gr.Accordion(label="⚙️ Parameters", open=True,): tools = gr.Textbox( value = tools_schema, label = "Tools schema", ) temperature = gr.Slider( minimum=0, maximum=1, step=0.1, value=0.3, label="Temperature", ), max_tokens = gr.Slider( minimum=128, maximum=8192, step=1, value=1024, label="Max new tokens", ) msg.submit(fn = stream_chat, inputs = [msg, chatbot, tools, temperature, max_tokens], outputs = [chatbot]) send.click(fn = stream_chat, inputs = [msg, chatbot, tools, temperature, max_tokens], outputs = [chatbot])
if __name__ == "__main__": demo.launch()app.py+39-42