Spaces:
Sleeping
Sleeping
Update app.py
Browse files21 unmodified lines222324252627282930313233343536373815 unmodified lines5455565721 unmodified linesmessages.append({"role": "user", "content": message})# Get the response from the model (with stream=False)response = ""response_data = client.chat_completion(messages,max_tokens=max_tokens,temperature=temperature,top_p=top_p,stream=False # Ensure we get the full response, not a stream)# Collect the full responseresponse = response_data["choices"][0]["message"]["content"]return response15 unmodified lines],)demo.launch()21 unmodified lines222324252627282930313233343536373815 unmodified lines545556575821 unmodified linesmessages.append({"role": "user", "content": message})# Get a single complete response (disable streaming)response = ""response_data = client.chat_completion(messages,max_tokens=max_tokens,temperature=temperature,top_p=top_p,stream=False # Disable streaming to ensure a complete response at once)# Get the full content of the answer from the responseresponse = response_data["choices"][0]["message"]["content"]return response15 unmodified lines],)if __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=7860)
app.py+5-4