Update app.py
Browse files11 unmodified lines12131415161718192011 unmodified lines3233343536373839404129 unmodified lines71727374757677781 unmodified line80818283848586878889909192939411 unmodified linesmessage,history: list[tuple[str, str]],system_message,max_tokens,temperature,top_p,):messages = [{"role": "system", "content": system_message}]11 unmodified linesif model_name == "Llama":for message in client.chat_completion(messages,max_tokens=max_tokens,stream=True,temperature=temperature,top_p=top_p,):token = message.choices[0].delta.contentresponse += token29 unmodified lines"""# Define the Gradio interface with buttons and model selectiondef gradio_interface(model_name, message, history, system_message, max_tokens, temperature, top_p):return respond(model_name, message, history, system_message, max_tokens, temperature, top_p)demo = gr.Interface(1 unmodified lineinputs=[gr.Textbox(value="Hello!", label="User Message"),gr.Textbox(value="You are a virtual health assistant. Your primary goal is to assist with health-related queries.", label="System Message", visible=False),gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new 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 (nucleus sampling)"),gr.Button("Chatgpt"),gr.Button("Llama"),gr.Button("Claude"),11 unmodified lines12131415161711 unmodified lines2930313233343536373829 unmodified lines68697071727374751 unmodified line77787980818211 unmodified linesmessage,history: list[tuple[str, str]],system_message,):messages = [{"role": "system", "content": system_message}]11 unmodified linesif model_name == "Llama":for message in client.chat_completion(messages,max_tokens=512, # Set a default value for max_tokensstream=True,temperature=0.7, # Set a default value for temperaturetop_p=0.95, # Set a default value for top_p):token = message.choices[0].delta.contentresponse += token29 unmodified lines"""# Define the Gradio interface with buttons and model selectiondef gradio_interface(model_name, message, history, system_message):return respond(model_name, message, history, system_message)demo = gr.Interface(1 unmodified lineinputs=[gr.Textbox(value="Hello!", label="User Message"),gr.Textbox(value="You are a virtual health assistant. Your primary goal is to assist with health-related queries.", label="System Message", visible=False),gr.Button("Chatgpt"),gr.Button("Llama"),gr.Button("Claude"),
app.py+5-17