Used two model, but only from one model i get response

from flask import Flask, request, jsonify
from flask_cors import CORS
import openai

app = Flask(name)
CORS(app) # Enable CORS for the entire app

openai.api_key = “api key”
gpt_model_id = ‘gpt-3.5-turbo’
dalle_model_engine = “DALL·E”
conversation =

@app.route(‘/ask’, methods=[‘POST’])
def generate_answer():
user_message = request.json[‘userMessage’]
conversation.append({‘role’: ‘user’, ‘content’: user_message})

# Check if the question is related to image generation
if 'image' in user_message.lower():
    # Generate image using DALL·E
    dalle_response = openai.Image.create(
    image_url = dalle_response['data'][0]['url']
    return jsonify({"imageurl": image_url})

    # Generate response using GPT-3.5 Turbo
    gpt_response = openai.ChatCompletion.create(
    gpt_reply = gpt_response.choices[0].message.content

    conversation.append({'role': 'assistant', 'content': gpt_reply})

    return jsonify({"aiResponse": gpt_reply})

if name == ‘main’:

i have used two model gpt turbo and dalle , but i am getting output from only one model dalle , not from gpt turbo… dalle is used to generate image and gpt used to general query .

i want to get ouput from both model. if question has image word, output get from dalle model, if not image , output from gpt model …

can you correct code ?

thank you