Not getting the output for AI image generator code

I have written the code as the per the instructions provided but I am not able to get the desired output. Below is the screenshot

My code:

import openai
from flask import Flask,render_template_string, request


def generate_tutorial(components):
response = openai.Image.create(
image_url = response[“data”][0][“url”]

return image_url

app= Flask(name)

def hello():
output = “”
if request.method== ‘POST’:
components= request.form[‘components’]
output= generate_tutorial(components)
return render_template_string(‘’’

Infinite Image Generator body { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f5f5f5; } .container { background-color: #ffffff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } h1 { color: #333333; } .form-control { background-color: #f8f8f8; border: 1px solid #dddddd; color: #333333; } .btn-primary { background-color: #89c2d9; border-color: #89c2d9; } .btn-primary:hover { background-color: #a3d1e0; border-color: #a3d1e0; } .btn-secondary { background-color: #b0b0b0; border-color: #b0b0b0; } .btn-secondary:hover { background-color: #c2c2c2; border-color: #c2c2c2; } .card { background-color: #f8f8f8; border: none; } #output { display: block; margin-bottom: 20px; text-align: center; } #myImage { width: 256px; height: 256px; display: block; margin: 0 auto; }

Custom Image Generator

<label for="components" class="form-label">Textual Description of the Image:</label>

<input type="text" class="form-control" id="components" name="components" placeholder="Enter the Description (Ex: A Lion in a Cage)" required>

Share with the Image


<button class="btn btn-secondary btn-sm" onclick="copyToClipboard()">Copy</button>
<p id="output" style="white-space: pre-wrap;">Generating an image for you...</p>

<img id="myImage" src="">




def generate():
return generate_tutorial(components)

if name == ‘main’:‘’, port=8080)

Hi @gtaruni456 I noted your query, please give me some time to check it on.