Spaces:
Sleeping
Sleeping
Update app.py
Browse files21 unmodified lines2223242525262727282930313233343233343536373638394021 unmodified lines
messages.append({"role": "user", "content": message})
# Instead of streaming, generate the response and return it once # Get the response from the model (with stream=False) response = "" for message in client.chat_completion( response_data = 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 stream=False # Ensure we get the full response, not a stream )
# Collect the full response response = response_data["choices"][0]["message"]["content"]
# Return the complete response return response
# Create the Gradio interfaceapp.py+7-6