Recipe generator not getting the output as expected

I have followed the same updated code from the training platform

from boltiotai import openai
import os
from flask import Flask, render_template_string, request
openai.api_key = os.environ[‘OPENAI_API_KEY’]

def generate_tutorial(components): response = model=“gpt-3.5-turbo”, messages=[{ “role”: “system”, “content”: “You are a helpful assistant” }, { “role”: “user”, “content”: f"Suggest a recipe using the items listed as available. Make sure you have a nice name for this recipe listed at the start. Also, include a funny version of the name of the recipe on the following line. Then share the recipe in a step-by-step manner. In the end, write a fun fact about the recipe or any of the items used in the recipe. Here are the items available: {components}, Haldi, Chilly Powder, Tomato Ketchup, Water, Garam Masala, Oil" }]) return response[‘choices’][0][‘message’][‘content’]

app = Flask(name)
@app.route(‘/’, methods=[‘GET’, ‘POST’])

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

This is a HTML template for a Custom Recipe Generator web page. It includes a form for users to input a list of ingredients/items they have, and two JavaScript functions for generating a recipe based on the input and copying the output to the clipboard. The template uses the Bootstrap CSS framework for styling.

return render_template_string(‘’’ Infinite Project Generator

Custom Recipe Tutorial Generator

Ingredients / Items:
Share with me a tutorial
Output: Copy
{{ output }}
‘’', output=output)

This code defines a route for the URL “/generate” that only accepts POST requests.

@app.route(‘/generate’, methods=[‘POST’])

This code defines a function ‘generate’ that takes a POST request containing a ‘components’ field and returns the result of calling the ‘generate_tutorial’ function with the provided components as input.

def generate(): components = request.form[‘components’] return generate_tutorial(components)

This code snippet starts the Flask application if the script is being run directly as the main program, running on the IP address ‘’ and port number 8080.

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

@avneetkjan Can you share the screenshot of the “console” tab if there are any errors? Also share the screenshot of your code so that we can help you debug the issue.

Ok sir. Here’s the screenshots of the code

And here’s the screenshot of console tab

Hi @avneetkjan,

The code seems to be correct.

Based on the screenshots you have shared, it appears that you have not clicked the RUN button. Please click the RUN button and then share a screenshot of both the Console and Webview with us.

As soon as you click on the RUN button, it will start the development server

This will allow us to see if there are any errors in the console.


There is an indentation error in line 92 of your code. The code has to start from the beginning of the line, you have added a space at the start of the line. Please correct that and try to run the code

if __name__ == '__main__':'', port=8080)

Let us know if this solves the problem

And sir as per your instructions i 've corrected the indentation errors but Still not resolved .

At webview output is yet like this only

At console tab it shows this

Sir, i have shared the screenshots after clicking the run button .
at console tab side it shows no error,
but showing this as you can see on screenshots
—>poetry add flask
The following packages are already present in the pyproject.toml and will be skipped:

• flask
If you want to update it to the latest compatible version, you can use poetry update package.
If you prefer to upgrade it to the latest available version, you can use poetry add package@latest.
Nothing to add.

Hi @avneetkjan,

We see that your issue has not been resolved. Can you please share your repl to so that we can check the code from our end and debug it

To share a Repl, click on the invite button at the top right corner and enter the email id

If you still face any issue, please feel free to get back to us.

The issue has been resolved i get t the output

Hi @avneetkjan,

Thank you for the confirmation.

Happy Learning!! :slight_smile: