Spaces:
Runtime error
Runtime error
Update app.py
Browse files136 unmodified lines1371381391401411421431441451461473 unmodified lines151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197136 unmodified lines"B22", "LLAMA_3", "PHI_3"]with gr.Blocks() as demo:gr.Markdown(description)with gr.Row():model_dropdown = gr.Dropdown(choices=['Oumuamua-7b-RP_Q4_K_M.gguf','Oumuamua-7b-instruct-v2-Q4_K_M.gguf','umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M.gguf',3 unmodified lines],value="Oumuamua-7b-RP_Q4_K_M.gguf",label="Model")template_dropdown = gr.Dropdown(choices=templates,value="LLAMA_3",label="Template")chatbot = gr.Chatbot()with gr.Row():system_message = gr.Textbox(value="You are a helpful assistant.", label="System message")with gr.Row():max_tokens = gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens")temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")with gr.Row():top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")top_k = gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k")with gr.Row():repeat_penalty = gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty")submit_btn = gr.Button("Send")clear_btn = gr.Button("Clear")undo_btn = gr.Button("Undo")retry_btn = gr.Button("Retry")def handle_response(message, history):return list(respond(message,history,model_dropdown.value,system_message.value,max_tokens.value,temperature.value,top_p.value,top_k.value,repeat_penalty.value,template_dropdown.value))submit_btn.click(fn=handle_response, inputs=[chatbot.input, chatbot.history], outputs=chatbot)clear_btn.click(lambda: None, None, chatbot)undo_btn.click(lambda x: x[:-1] if x else None, chatbot, chatbot)retry_btn.click(lambda x: x[:-1] if x else None, chatbot, chatbot)demo.launch()136 unmodified lines1371381391401411421431441451463 unmodified lines150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198136 unmodified lines"B22", "LLAMA_3", "PHI_3"]demo = gr.ChatInterface(fn=respond,inputs=[gr.Dropdown(['Oumuamua-7b-RP_Q4_K_M.gguf','Oumuamua-7b-instruct-v2-Q4_K_M.gguf','umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M.gguf',3 unmodified lines],value="Oumuamua-7b-RP_Q4_K_M.gguf",label="Model"),gr.Dropdown(choices=templates,value="LLAMA_3",label="Template"),gr.Textbox(value="You are a helpful assistant.", label="System message"),gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p",),gr.Slider(minimum=0,maximum=100,value=40,step=1,label="Top-k",),gr.Slider(minimum=0.0,maximum=2.0,value=1.1,step=0.1,label="Repetition penalty",),],retry_btn="Retry",undo_btn="Undo",clear_btn="Clear",submit_btn="Send",title="Chat with various models using llama.cpp",description=description,chatbot=gr.Chatbot(scale=1,likeable=False,show_copy_button=True))if __name__ == "__main__":demo.launch()
app.py+46-45