CodeNewbie Community 🌱

Flockkki
Flockkki

Posted on

Building an Online Appliance Booking App with GPT

I wanted to share how I built a small online appliance booking platform using GPT API along with other tools like Flask and SQLite. My goal was to allow users to book services for used home appliances, like repairs or delivery, in a simple way.

Here is the basic workflow:

Frontend – HTML and Bootstrap for quick forms.

Backend – Flask handles booking requests and connects to the database.

AI Integration – GPT helps generate service instructions and quick replies for users.

Database – SQLite stores booking details like name, phone, and appliance type.

Below is a very small working example to show how I connected Flask with GPT to confirm bookings.

`from flask import Flask, request, render_template
import openai
import sqlite3

app = Flask(name)
openai.api_key = "your_api_key"

def save_booking(name, phone, appliance):
conn = sqlite3.connect('bookings.db')
c = conn.cursor()
c.execute("CREATE TABLE IF NOT EXISTS bookings (name TEXT, phone TEXT, appliance TEXT)")
c.execute("INSERT INTO bookings VALUES (?, ?, ?)", (name, phone, appliance))
conn.commit()
conn.close()

def get_ai_reply(appliance):
prompt = f"Confirm booking for {appliance} repair in simple text."
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=50
)
return response.choices[0].text.strip()

@app.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
name = request.form["name"]
phone = request.form["phone"]
appliance = request.form["appliance"]
save_booking(name, phone, appliance)
reply = get_ai_reply(appliance)
return f"

{reply}

"
return render_template("index.html")

if name == "main":
app.run(debug=True)
`

This is just a starting point, but with a bit more work you can add login systems, admin dashboards, or even connect payment gateways.

I also tested some ideas where the platform could help small shops that sell used home appliances Sharjah, making the booking feature even more useful for customers.

Would love to hear your feedback or suggestions on scaling this up, maybe with FastAPI or React frontend.

Top comments (0)