by Luhanm
Cooking Companion
import os
from flask import Flask, request, render_template_string, session, jsonify
from flask_session import Session
from abilities import llm_prompt
app = Flask(__name__)
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)
TEMPLATE = """
<!doctype html>
<html>
<head>
<title>AI Cooking Assistant</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f3f4f6;
color: #333;
}
#chatBox {
display: none;
border: 2px solid #ffc107;
Created: | Last Updated:
Introduction to the Cooking Companion Template
Welcome to the Cooking Companion template guide! This template is designed to help you create an AI-powered cooking assistant app. The app provides recipes, answers cooking questions, and features a chat with an AI chef. It's a perfect solution for those looking to integrate a smart cooking guide into their software offerings.
Getting Started
To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will set up the template in your Lazy Builder interface, ready for customization and deployment.
Test: Deploying the App
Once you have the template loaded, press the "Test" button to start the deployment process. The Lazy CLI will handle the deployment, and you won't need to worry about installing libraries or setting up the environment.
Entering Input
If the template requires user input, the Lazy App's CLI interface will prompt you to provide it after pressing the "Test" button. Follow the prompts to input the necessary information for your app to function correctly.
Using the App
After deployment, the app will provide a frontend experience where users can interact with the AI cooking assistant. Users can ask for recipes, get answers to cooking-related questions, and navigate through cooking steps. The interface includes buttons and forms to facilitate user interaction.
Integrating the App
If you need to integrate this app into an external service or frontend, you will be provided with a dedicated server link to use the API. This link can be added to your external tool to allow users to interact with the Cooking Companion app from within your existing software environment.
Here's a sample request you might send to the app's API:
`POST /ask HTTP/1.1
Host: [your-server-link]
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
question=How+long+should+I+bake+chicken?` And a sample response from the API might look like this:
{
"answer": "Bake the chicken for 25 minutes at 350 degrees Fahrenheit."
}
Remember, all the steps listed above are mandatory to run and integrate the template successfully. Follow them carefully to ensure your Cooking Companion app works flawlessly.
If you encounter any issues or need further assistance, refer to the documentation provided in the code or reach out to the Lazy platform support team.