Spaces:
Sleeping
Sleeping
Update app.py
Browse files21 unmodified lines22232425262728293031323334353637383921 unmodified linesmessages.append({"role": "user", "content": message})# Instead of streaming, generate the response and return it onceresponse = ""for message in client.chat_completion(messages,max_tokens=max_tokens,temperature=temperature,top_p=top_p,stream=False # Disable streaming to get a complete response in one go):response += message.choices[0].text # Collect the entire response# Return the complete responsereturn response# Create the Gradio interface21 unmodified lines2223242526272829303132333435363738394021 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 response# Create the Gradio interface
app.py+7-6