예제 #1
0
def main():
    print("starting the demo")
    database = []
    db.init_database(database)
    serialcomm = serial.Serial('/dev/cu.usbmodem1101', 9600)
    #serialcomm.timeout = 1

    add(database, "red")
    add(database, "blue")
    print_database(database)
    take(database, "red")
    print_database(database)
    add(database, "red")
    serialcomm.close()
    return 0
예제 #2
0
        global_clothes_information = [(("Tee", "blue"), ("jeans", "red")),
                                      ("onepiece", "green")]

        filenames = ["0.jpg", "1.jpg"]
        return render_template("show_take.html", imgs=filenames)


@app.route("/update_take", methods=["POST", "GET"])
def update_take():
    if request.method == "POST":
        # here I will update the database
        i = db.find_clothes_index(database, cur_type_of_clothes, cur_color)
        db.remove_from_database(database, i)
        cur_angle = i * 9
        return redirect(url_for('home'))

    else:
        print("going to update_take.html")
        return render_template("update_take.html")


if __name__ == "__main__":
    print("starting smartwardrobe")
    db.init_database(database)
    db.print_database(database)
    cur_angle = 0
    #vapi = vi.VisualizerAPI()
    #cc = vapi.clothingRecModel.classifier
    # webs = ws.WebScraper()
    #serialcomm = serial.Serial('/dev/cu.usbmodem1101', 9600)
    app.run(debug=True)
예제 #3
0
import datetime
import locale

locale.setlocale(locale.LC_ALL, 'fr_FR')

from database.models import Product, User, Reservation

app = flask.Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///database/database.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SECRET_KEY"] = "secret_key1234"

db.init_app(app)

with app.test_request_context():
    init_database()


def save_object_to_db(db_object):
    db.session.add(db_object)
    db.session.commit()


def remove_object_from_db(db_object):
    db.session.delete(db_object)
    db.session.commit()


def find_reservations():
    return Reservation.query.all()