|
from flask import Flask, render_template, request |
|
import random |
|
import json |
|
|
|
app = Flask(__name__) |
|
|
|
data_file = "Perceptrix/finetune/finetune-data/crystal-finetune.json" |
|
|
|
with open(data_file, 'r') as data: |
|
data = json.loads(data.read()) |
|
|
|
|
|
room_descriptions = ["The surroundings include a bed, a chair, and a dog. The bed is made up with a white blanket, and there are two people sitting on it, likely a man and a woman. The chair is positioned next to the bed, and the dog is sitting on the bed as well. The room appears to be a bedroom, and the atmosphere seems to be cozy and comfortable.", |
|
"In the image, there is a living room with a couch, a chair, a coffee table, and a window. The room is well-decorated and filled with furniture, including a bed, a desk, and a dining table. The living room is situated next to the bedroom, and there is a window in the living room. The overall atmosphere of the room is cozy and inviting.", |
|
"The surroundings include a living room with a couch, a chair, and a coffee table. There is also a television in the room.", |
|
"In the image, there is a group of people sitting in chairs, likely in a classroom or a meeting room. They are engaged in a discussion or a presentation, with some of them looking at a screen.", |
|
"The surroundings include a living room with a couch, a chair, and a window. The room is well-lit, and there are several potted plants in the space.", |
|
"In the image, a woman is lying on a bed surrounded by a variety of stuffed animals. There are at least ten stuffed animals of different colors and sizes, including teddy bears, dolls, and other toys. The scene appears to be cozy and comfortable, with the woman resting peacefully in her bed.", |
|
"The surroundings include a living room with a yellow couch, a table, and a potted plant. There are three people sitting on the couch, and a laptop is placed on the table.", |
|
"The surroundings include a living room with a couch, a coffee table, and a TV. The room is filled with people, and they are sitting on the couch, engaging in a conversation.", |
|
"The surroundings include a living room with a couch, a chair, and a window. There is also a woman standing in the room, possibly near the window. The room appears to be clean and well-maintained.", |
|
"The surroundings include a living room with a bed, a couch, a chair, and a TV. There are also various items scattered around, such as a book, a bottle, and a cup. The room appears to be messy and disorganized, with some items like the book and bottle being placed on the floor.", |
|
"In the image, there is a bedroom with a bed, a chair, and a window. A woman is sitting on the bed, and a dog is nearby. The woman is wearing a white shirt and appears to be engaged in a conversation with the AI assistant. The room appears to be clean and well-organized.", |
|
"I am in a living room, sitting on a couch, and using a laptop.", |
|
"The surroundings include a couch, a chair, a window, and a potted plant. There is also a person sitting on the couch, and a baby is laying on the person's lap.", |
|
"In the image, there is a group of people standing in a living room, with a bed and a couch visible in the background. The room appears to be clean and well-organized.", |
|
"In the image, there is a living room with a white couch, a chair, and a window. The room is well-lit and appears to be clean and organized.", |
|
"The surroundings consist of a large, empty room with a hardwood floor. There is a man sitting on the floor, possibly in a corner or a cubicle, and he is holding a remote control.", |
|
"The surroundings include a living room with a woman standing in front of a door, which is open. The room appears to be dimly lit, creating a somewhat dark atmosphere.", |
|
"The surroundings include a living room with a couch, a chair, and a TV. There are three people sitting on the couch, and a baby is present. The living room appears to be a comfortable and cozy space for the family to spend time together.", |
|
"In the image, there is a person sitting on a bed in a bedroom. The bed is surrounded by a colorful blanket, and there is a laptop on the bed. The room appears to be a small bedroom, and the bed is positioned near a window.", |
|
"The surroundings include a bedroom with a bed, a nightstand, and a window. The bed is neatly made and has a white and gray color scheme. There are also potted plants in the room, adding a touch of greenery and a sense of freshness.", |
|
"In the image, there is a large bedroom with a bed, a nightstand, and a window. The room is clean and well-organized, with a white color scheme and a minimalist design. The bed is neatly made, and there are pillows on it. The room also has a chair and a potted plant, adding a touch of warmth and natural elements to the space. The window provides natural light, and the room appears to be well-lit and inviting.", |
|
"In the image, there is a living room with a couch, a chair, and a coffee table. The room is well-decorated and features a dark color scheme, with a black couch and a black coffee table. There is also a potted plant in the room, adding a touch of greenery to the space. The living room is well-lit, and there are several books scattered around the room, suggesting that the occupants enjoy reading.", |
|
"In the image, there is a living room with a large window, a couch, and a chair. The room is filled with furniture, including a coffee table, a dining table, and a potted plant. The living room has a modern and clean design, with a white color scheme. The large window allows for natural light to enter the room, creating a bright and inviting atmosphere.", |
|
"In the image, there is a bedroom with a large bed, a nightstand, and a window. The room is well-lit and clean, creating a comfortable and inviting atmosphere.", |
|
"The surroundings include a living room with a couch, a coffee table, and a television. The room is filled with various items, such as books, a vase, and a potted plant. The living room is well-lit, and there is a window in the room. Additionally, there is a dining table and chairs, which suggests that the living room and dining area are combined.", |
|
"In the image, I am surrounded by a living room with a piano, a couch, and a chair. The living room has a modern design, and the furniture is arranged in a way that creates a comfortable and inviting atmosphere.", |
|
"The surroundings include a living room with a couch, a coffee table, and a vase. The living room is well-decorated and has a clean and organized appearance.", |
|
"The surroundings include a large bedroom with a white color scheme, a bed with a white comforter, and a window. There is also a ceiling fan, which is a white fan, and a chair in the room. The room appears to be clean and well-maintained.", |
|
"In the image, there is a green couch, a green chair, and a green ottoman in a living room. The room is filled with books, suggesting that it is a cozy and well-read space.", |
|
"The surroundings include a large bedroom with a large bed, a chair, and a desk. The room also has a window, a lamp, and a mirror. The bed is neatly made, and there are pillows on it. The room is well-lit, with a lamp providing illumination.", |
|
"In the image, there is a living room with a couch, a chair, and a table. The room has a modern design, featuring a large window and a chandelier. The living room is filled with furniture, including a couch, a chair, and a table. The room also has a potted plant, which adds a touch of greenery and a sense of freshness to the space. The living room is well-lit, with the large window providing ample natural light, and the chandelier adding a touch of elegance and sophistication.", |
|
"I am in a living room with a fireplace, a couch, a chair, a dining table, and a potted plant. The room is filled with furniture and decorations, creating a cozy and inviting atmosphere.", |
|
"In the image, there is a living room with a couch, two chairs, and a coffee table. The living room is well-lit and has a view of the city, which adds to the ambiance of the space. The room also features a potted plant and a vase, adding a touch of greenery and decoration to the area.", |
|
"In the image, there is a neatly made bed in a bedroom, with a white comforter and a red blanket. The bed is situated next to a window, which allows natural light to enter the room. The room also has a nightstand with a lamp, providing additional lighting. The overall atmosphere of the room is clean and inviting.", |
|
"In the image, I am surrounded by a large, clean living room with white walls, a fireplace, and a comfortable couch. There are also several chairs and a dining table in the room. The space is well-lit, and the furniture is arranged to create a cozy and inviting atmosphere.", |
|
"The surroundings in the image include a living room with a couch, chairs, and a coffee table. The living room is filled with furniture, and there are multiple lamps and potted plants scattered throughout the space. The room also has a window, which allows natural light to enter the room.", |
|
"The surroundings include a living room with a couch, a coffee table, and a lamp. The room also has a large window, which allows for natural light to enter. There are several chairs and a dining table in the room, suggesting that it is a multi-purpose space for relaxation and dining. The living room is well-lit and furnished with comfortable seating options, creating a welcoming atmosphere for people to gather and socialize.", |
|
"In the image, I am surrounded by a living room filled with furniture, including a couch, chairs, and a coffee table. The living room is well-decorated, and there are several books and a vase present. The room also features a rug, which adds to the overall aesthetic and comfort of the space.", |
|
"The surroundings include a messy room with a bed, a desk, and a chair. The room is filled with clothes, shoes, and other items, creating a cluttered and disorganized space.", |
|
"The surroundings in the image include a cluttered room with a desk, a bed, and various items scattered around. The room appears to be messy and disorganized, with clothes and other belongings scattered on the floor.", |
|
"The surroundings include a group of people sitting on a bed, with a laptop and a cell phone visible. The room appears to be a bedroom, and the individuals are engaged in a conversation.", |
|
"I am in a living room, surrounded by several people sitting on a couch. They are all engaged in various activities, such as watching TV, using their cell phones, and possibly playing video games. The room is filled with furniture, including a couch, chairs, and a TV. The atmosphere appears to be casual and relaxed, with the people enjoying their time together in the living room.", |
|
"The surroundings include a group of people sitting on a couch, with a wooden table in the background. The room appears to be a living room, and there is a window nearby.", |
|
"In the image, there are several people sitting on a couch, using their cell phones. The couch is located in a living room, and the people are engaged in various activities on their devices.", |
|
"The surroundings include a living room with a fireplace, where a group of people is sitting on couches and chairs. There are multiple books scattered around the room, suggesting that the individuals might be engaged in reading or studying. The room also has a dining table and a potted plant, which adds to the cozy atmosphere of the space.", |
|
"The surroundings include a living room with a couch, a dining table, and a pizza on the table. The people in the room are sitting and enjoying their meal together.", |
|
"In the image, there are four people sitting on a bed, with two of them facing the camera. They are all wearing blue shirts and are engaged in a conversation. The scene takes place in a bedroom, which is a comfortable and familiar setting for the group.", |
|
"The surroundings include a group of people sitting on a couch, with some of them holding pizza boxes. The room appears to be a living room, and there is a book nearby.", |
|
"In the image, there are four people sitting on a couch in a living room. They are all engaged in using their cell phones, with one of them holding a book. The room has a wooden floor and a table, and there are chairs nearby. The atmosphere appears to be casual and relaxed, with the group of friends enjoying their time together while using their devices.", |
|
"I am in a living room, which is filled with furniture such as a couch, a chair, and a table. The room is well-lit and appears to be a comfortable space for relaxation and socializing.", |
|
"The surroundings include a living room with a couch, a table, and a chair. There are people sitting on the couch and a man standing in the room.", |
|
"The surroundings include a group of people sitting on a couch, likely in a living room or a similar space. They are engaged in a conversation or enjoying each other's company.", |
|
"The surroundings include a living room with a couch, a chair, and a table. There are several people sitting on the couch and chairs, engaging in conversation and enjoying each other's company. The room appears to be well-lit, creating a comfortable atmosphere for socializing.", |
|
"In the image, there is a group of people sitting around a dining table in a room. The table is covered with various items, including cups, bowls, and a vase. The room appears to be a living room or a dining area, with a couch and chairs nearby. The scene suggests a casual and comfortable setting where people are gathered for a meal or a social event.", |
|
"The surroundings include a living room with a couch, a dining table, and a TV. The room is filled with people, some of whom are sitting on the couch, while others are standing around the table. There are also several bottles and cups, which might be used for drinking. The atmosphere appears to be relaxed and social, with people enjoying each other's company and engaging in conversations.", |
|
"The surroundings include a living room with a couch, a coffee table, and a window. There are three people sitting on the couch, engaging in a conversation.", |
|
"The surroundings include a living room with a couch, a table, and a couple of chairs. There are also several bottles and cups on the table, suggesting that the room is set up for a casual gathering or a social event.", |
|
"The surroundings include a living room with a couch, chairs, and a coffee table. There are also books scattered around the room, suggesting that the group of people might be engaged in a discussion or reading. The room appears to be cozy and comfortable, with a relaxed atmosphere.", |
|
"The surroundings include a living room with a couch, a television, and a group of people sitting together."] |
|
|
|
cities = ["Wake Forest, NC", "Rocky Mount, NC", "San Francisco, CA", "New York City, NY", "Trenton, NJ", "Philadelphia, PA", |
|
"Vikas Puri, New Delhi", "Jiugong, Beijing", "Les Halles, Paris", "Diemen, Amsterdam", "Al Shamkhah, Abu Dhabi", |
|
"Cairo", "Idore, Madhya Pradesh", "Bangalore, Karnataka", "Toronoto, Ontario", "Brixton, London", "Charlotte, NC", |
|
"Los Angeles, CA", "Las Vegas, NV", "Cupertino, CA", "Silicon Valley, CA", "Sham Shui Po, Hong Kong", "Danilovsky District, Moscow", |
|
"Rochester, NY", "Manhattan, NY"] |
|
weather_names = ["Sunny", "Rainy", "Windy", "Cloudy", |
|
"Mostly Cloudy", "Partly Cloudy", "Light Rain", "Sleet"] |
|
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] |
|
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", |
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
|
|
|
dummy_time = f"{random.choice(days)} {random.randint(1, 30)} {random.choice(months)} {random.randint(2020, 2024)} 0{random.randint(1, 9)}:{random.randint(0, 59)} {random.choice(['AM', 'PM'])}" |
|
dummy_weather = f"{random.choice(cities)} is {random.choice(weather_names)} with {random.randint(60, 95)}°F and Precipitation: {random.randint(0, 100)}%, Humidity: {random.randint(0, 100)}%, Wind: {random.randint(1, 15)} mph" |
|
dummy_current_events = random.choice(room_descriptions) |
|
|
|
|
|
@app.route("/") |
|
def home(): |
|
return render_template("index.html", full_data=json.dumps(data, indent=4), data_entries=len(data), dummy_time=dummy_time, dummy_weather=dummy_weather, dummy_current_events=dummy_current_events[:-1]) |
|
|
|
|
|
@app.route('/record', methods=['GET', 'POST']) |
|
def record(): |
|
if request.method == "POST": |
|
with open(data_file, 'r') as data: |
|
data = json.loads(data.read()) |
|
dummy_time = f"{random.choice(days)} {random.randint(1, 30)} {random.choice(months)} {random.randint(2020, 2024)} 0{random.randint(1, 9)}:{random.randint(0, 59)} {random.choice(['AM', 'PM'])}" |
|
dummy_weather = f"{random.choice(cities)} is {random.choice(weather_names)} with {random.randint(60, 95)}°F and Precipitation: {random.randint(0, 100)}%, Humidity: {random.randint(0, 100)}%, Wind: {random.randint(1, 15)} mph" |
|
dummy_current_events = random.choice(room_descriptions) |
|
|
|
entry = request.form["current-data-preview"] |
|
input_field = request.form["input"] |
|
entry = { |
|
"prompt": entry.split(entry.split(input_field)[-1])[0], |
|
"response": entry.split(input_field)[-1][2:], |
|
} |
|
data.append(entry) |
|
with open(data_file, 'w') as file: |
|
file.write(str(json.dumps(data, indent=4)).replace("\r\n", "\n")) |
|
|
|
return render_template("index.html", full_data=json.dumps(data, indent=4), data_entries=len(data), dummy_time=dummy_time, dummy_weather=dummy_weather, dummy_current_events=dummy_current_events[:-1]) |
|
|
|
|
|
if __name__ == "__main__": |
|
app.run() |
|
|