Spaces:
Sleeping
Sleeping
Init
Browse files- .gitignore +1 -0
- .python-version +1 -0
- app.py +100 -0
- requirements.txt +52 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.venv/
|
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.10.15
|
app.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def submit_form(
|
| 5 |
+
title: str,
|
| 6 |
+
description: str,
|
| 7 |
+
hashtags: list[str],
|
| 8 |
+
condition: str,
|
| 9 |
+
designer_names: list[str],
|
| 10 |
+
category_path: list[str],
|
| 11 |
+
color,
|
| 12 |
+
size,
|
| 13 |
+
followers,
|
| 14 |
+
user_score,
|
| 15 |
+
):
|
| 16 |
+
print(
|
| 17 |
+
f"Title: {title}, Description: {description}, Hashtags: {hashtags}, Condition: {condition}, Designer Names: {designer_names}, Category Path: {category_path}, Color: {color}, Size: {size}, Followers: {followers}, User Score: {user_score}"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Function to add a new text field
|
| 22 |
+
def add_field(num_fields):
|
| 23 |
+
num_fields += 1
|
| 24 |
+
return num_fields
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Function to remove the last text field
|
| 28 |
+
def remove_field(num_fields):
|
| 29 |
+
assert num_fields > -1, "There can be no negative fields"
|
| 30 |
+
if num_fields == 0:
|
| 31 |
+
return num_fields
|
| 32 |
+
|
| 33 |
+
num_fields -= 1
|
| 34 |
+
return num_fields
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
with gr.Blocks(theme="argilla/argilla-theme", title="Grailed Price Predictor") as demo:
|
| 38 |
+
gr.HTML(
|
| 39 |
+
"""
|
| 40 |
+
<h1 style="text-align: center;">Grailed Price Predictor</h1>
|
| 41 |
+
<p>Welcome to our Grailed Price Prediction Model! This project, developed for the ID2223 course,
|
| 42 |
+
demonstrates how modern machine learning systems can be effectively implemented using feature stores and serverless computing.
|
| 43 |
+
To get started, simply fill out the form and click "Submit."</p>
|
| 44 |
+
"""
|
| 45 |
+
)
|
| 46 |
+
num_hashtags = gr.State(1)
|
| 47 |
+
num_designer_names = gr.State(1)
|
| 48 |
+
|
| 49 |
+
with gr.Group():
|
| 50 |
+
titleTextBox = gr.Textbox(label="Title")
|
| 51 |
+
descriptionTextArea = gr.TextArea(label="Description")
|
| 52 |
+
|
| 53 |
+
conditionDropdown = gr.Dropdown(
|
| 54 |
+
["new", "gently used", "used", "worn"],
|
| 55 |
+
label="Condition",
|
| 56 |
+
info="The condition of your item.",
|
| 57 |
+
interactive=True,
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
categoryPathTextBox = gr.Textbox(label="Category Path")
|
| 61 |
+
colorTextBox = gr.Textbox(label="Color")
|
| 62 |
+
sizeTextBox = gr.Textbox(label="Size")
|
| 63 |
+
|
| 64 |
+
with gr.Row():
|
| 65 |
+
with gr.Column():
|
| 66 |
+
|
| 67 |
+
@gr.render(inputs=num_hashtags)
|
| 68 |
+
def show_hashtags(n):
|
| 69 |
+
for i in range(n):
|
| 70 |
+
gr.Textbox(label="Hashtag")
|
| 71 |
+
|
| 72 |
+
with gr.Row():
|
| 73 |
+
addButton = gr.Button("Add Hashtag")
|
| 74 |
+
removeButton = gr.Button("Remove Hashtag")
|
| 75 |
+
addButton.click(add_field, num_hashtags, num_hashtags)
|
| 76 |
+
removeButton.click(remove_field, num_hashtags, num_hashtags)
|
| 77 |
+
|
| 78 |
+
with gr.Column():
|
| 79 |
+
|
| 80 |
+
@gr.render(inputs=num_designer_names)
|
| 81 |
+
def show_designer_names(n):
|
| 82 |
+
for i in range(n):
|
| 83 |
+
gr.Textbox(label="Designer Name")
|
| 84 |
+
|
| 85 |
+
with gr.Row():
|
| 86 |
+
addButton = gr.Button("Add Designer Name")
|
| 87 |
+
removeButton = gr.Button("Remove Designer Name")
|
| 88 |
+
addButton.click(add_field, num_designer_names, num_designer_names)
|
| 89 |
+
removeButton.click(
|
| 90 |
+
remove_field, num_designer_names, num_designer_names
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
with gr.Row():
|
| 94 |
+
followernoNumber = gr.Number(label="Number of Followers")
|
| 95 |
+
userScoreNumber = gr.Number(label="Your User Score")
|
| 96 |
+
submitButton = gr.Button("Submit")
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
if __name__ == "__main__":
|
| 100 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiofiles==23.2.1
|
| 2 |
+
annotated-types==0.7.0
|
| 3 |
+
anyio==4.8.0
|
| 4 |
+
certifi==2024.12.14
|
| 5 |
+
charset-normalizer==3.4.1
|
| 6 |
+
click==8.1.8
|
| 7 |
+
exceptiongroup==1.2.2
|
| 8 |
+
fastapi==0.115.6
|
| 9 |
+
ffmpy==0.5.0
|
| 10 |
+
filelock==3.16.1
|
| 11 |
+
fsspec==2024.12.0
|
| 12 |
+
gradio==5.9.1
|
| 13 |
+
gradio_client==1.5.2
|
| 14 |
+
h11==0.14.0
|
| 15 |
+
httpcore==1.0.7
|
| 16 |
+
httpx==0.28.1
|
| 17 |
+
huggingface-hub==0.27.0
|
| 18 |
+
idna==3.10
|
| 19 |
+
Jinja2==3.1.5
|
| 20 |
+
markdown-it-py==3.0.0
|
| 21 |
+
MarkupSafe==2.1.5
|
| 22 |
+
mdurl==0.1.2
|
| 23 |
+
numpy==2.2.1
|
| 24 |
+
orjson==3.10.13
|
| 25 |
+
packaging==24.2
|
| 26 |
+
pandas==2.2.3
|
| 27 |
+
pillow==11.1.0
|
| 28 |
+
pydantic==2.10.4
|
| 29 |
+
pydantic_core==2.27.2
|
| 30 |
+
pydub==0.25.1
|
| 31 |
+
Pygments==2.19.0
|
| 32 |
+
python-dateutil==2.9.0.post0
|
| 33 |
+
python-multipart==0.0.20
|
| 34 |
+
pytz==2024.2
|
| 35 |
+
PyYAML==6.0.2
|
| 36 |
+
requests==2.32.3
|
| 37 |
+
rich==13.9.4
|
| 38 |
+
ruff==0.8.6
|
| 39 |
+
safehttpx==0.1.6
|
| 40 |
+
semantic-version==2.10.0
|
| 41 |
+
shellingham==1.5.4
|
| 42 |
+
six==1.17.0
|
| 43 |
+
sniffio==1.3.1
|
| 44 |
+
starlette==0.41.3
|
| 45 |
+
tomlkit==0.13.2
|
| 46 |
+
tqdm==4.67.1
|
| 47 |
+
typer==0.15.1
|
| 48 |
+
typing_extensions==4.12.2
|
| 49 |
+
tzdata==2024.2
|
| 50 |
+
urllib3==2.3.0
|
| 51 |
+
uvicorn==0.34.0
|
| 52 |
+
websockets==14.1
|