Welcome to the Flash Card Generator template! This template is designed to help you create an application that generates flashcards on various topics using the OpenAI API. The app is built with Flask, a lightweight web application framework in Python, and it provides a simple web interface where users can enter a topic and receive a set of flashcards with questions and answers related to that topic.
To begin using this template, click on "Start with this Template" in the Lazy builder interface. This will set up the template in your workspace, and you can start customizing it according to your needs.
Before you can start using the Flash Card Generator, you need to set up an OpenAI API key as an environment secret. Here's how to do it:
With the API key set up, you're ready to test the application. Press the "Test" button in the Lazy builder interface. This will deploy your app and launch the Lazy CLI. You will not need to provide any input at this stage, as the app does not require CLI input for its core functionality.
Once the app is deployed, Lazy will provide you with a dedicated server link. Use this link to access the web interface of the Flash Card Generator. Here's how to use it:
If you wish to integrate the Flash Card Generator into another service or frontend, you can use the server link provided by Lazy to make POST requests to the `/generate` endpoint with the topic as form data. Here's a sample request you could use:
POST /generate HTTP/1.1<br>
Host: [Your Server Link]<br>
Content-Type: application/x-www-form-urlencoded<br>
<br>
topic=World+Capitals
And here's a sample response you might receive:
{<br>
"flashcards": [<br>
{<br>
"question": "What is the capital of France?",<br>
"answer": "Paris"<br>
},<br>
...<br>
]<br>
}
Remember, you can customize the template further to suit your specific needs. Enjoy building with Lazy!