Spaces:
Runtime error
Runtime error
Commit
·
a9fb110
1
Parent(s):
4425d84
feat: upload photos
Browse files
app.py
CHANGED
@@ -4,6 +4,16 @@ import requests
|
|
4 |
API_URL = 'https://pic-gai.up.railway.app'
|
5 |
# API_URL = 'http://localhost:8000'
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
st.title('CollageAI')
|
8 |
|
9 |
# Input field for user prompt
|
@@ -12,26 +22,17 @@ user_prompt = st.text_area(
|
|
12 |
placeholder="For our anniversary, I want to write a card to my partner to celebrate our love and share all the things I adore about them."
|
13 |
)
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
# pick number of photos
|
16 |
-
photos_count =
|
17 |
-
'How many photos would you like to use?',
|
18 |
-
min_value=0,
|
19 |
-
max_value=10,
|
20 |
-
)
|
21 |
|
22 |
# Submit buttons for templates and stickers
|
23 |
generate_button = st.button('Generate')
|
24 |
|
25 |
-
def gallery(column, images):
|
26 |
-
groups = []
|
27 |
-
for i in range(0, len(images), column):
|
28 |
-
groups.append(images[i:i+column])
|
29 |
-
|
30 |
-
for group in groups:
|
31 |
-
cols = st.columns(column)
|
32 |
-
for i, image in enumerate(group):
|
33 |
-
cols[i].image(image)
|
34 |
-
|
35 |
if generate_button:
|
36 |
if user_prompt:
|
37 |
# Prepare the params with the user prompt
|
|
|
4 |
API_URL = 'https://pic-gai.up.railway.app'
|
5 |
# API_URL = 'http://localhost:8000'
|
6 |
|
7 |
+
def gallery(column, images):
|
8 |
+
groups = []
|
9 |
+
for i in range(0, len(images), column):
|
10 |
+
groups.append(images[i:i+column])
|
11 |
+
|
12 |
+
for group in groups:
|
13 |
+
cols = st.columns(column)
|
14 |
+
for i, image in enumerate(group):
|
15 |
+
cols[i].image(image)
|
16 |
+
|
17 |
st.title('CollageAI')
|
18 |
|
19 |
# Input field for user prompt
|
|
|
22 |
placeholder="For our anniversary, I want to write a card to my partner to celebrate our love and share all the things I adore about them."
|
23 |
)
|
24 |
|
25 |
+
uploaded_images = st.file_uploader("Choose photos", accept_multiple_files=True)
|
26 |
+
if uploaded_images:
|
27 |
+
st.subheader('Uploaded photos:')
|
28 |
+
gallery(4, uploaded_images)
|
29 |
+
|
30 |
# pick number of photos
|
31 |
+
photos_count = len(uploaded_images)
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# Submit buttons for templates and stickers
|
34 |
generate_button = st.button('Generate')
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
if generate_button:
|
37 |
if user_prompt:
|
38 |
# Prepare the params with the user prompt
|