Spaces:
Sleeping
Sleeping
ProPerNounpYK
commited on
Commit
•
537f1cc
1
Parent(s):
78e41d5
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import openai
|
2 |
import streamlit as st
|
3 |
|
4 |
-
#
|
5 |
-
openai.api_key = "
|
6 |
|
7 |
# Outfit suggestions database
|
8 |
outfit_database = {
|
@@ -14,6 +14,10 @@ outfit_database = {
|
|
14 |
"red jacket": ["black turtleneck", "black trousers", "pointed heels", "gold necklace"],
|
15 |
"denim skirt": ["silk blouse", "nude pumps", "pearl earrings", "clutch bag"]
|
16 |
},
|
|
|
|
|
|
|
|
|
17 |
# Add more clothing items and styles here
|
18 |
}
|
19 |
|
@@ -34,14 +38,15 @@ def generate_outfit_advice(piece, color, style):
|
|
34 |
def generate_image_prompt(piece, color, style):
|
35 |
return f"A {style} outfit featuring a {color} {piece} styled with complementary clothing items and accessories. Modern, fashionable, and cohesive."
|
36 |
|
37 |
-
# Function to create outfit image using OpenAI's DALL-E
|
38 |
def create_outfit_image(prompt):
|
39 |
response = openai.Image.create(
|
|
|
40 |
prompt=prompt,
|
41 |
n=1,
|
42 |
size="1024x1024"
|
43 |
)
|
44 |
-
return response[
|
45 |
|
46 |
# Streamlit UI
|
47 |
def main():
|
|
|
1 |
import openai
|
2 |
import streamlit as st
|
3 |
|
4 |
+
# Initialize OpenAI API Key (use Hugging Face Secrets to store this securely)
|
5 |
+
openai.api_key = st.secrets["openai_api_key"]
|
6 |
|
7 |
# Outfit suggestions database
|
8 |
outfit_database = {
|
|
|
14 |
"red jacket": ["black turtleneck", "black trousers", "pointed heels", "gold necklace"],
|
15 |
"denim skirt": ["silk blouse", "nude pumps", "pearl earrings", "clutch bag"]
|
16 |
},
|
17 |
+
"streetwear": {
|
18 |
+
"red jacket": ["graphic tee", "cargo pants", "high-top sneakers", "beanie"],
|
19 |
+
"denim skirt": ["oversized hoodie", "combat boots", "chunky necklace", "fanny pack"]
|
20 |
+
},
|
21 |
# Add more clothing items and styles here
|
22 |
}
|
23 |
|
|
|
38 |
def generate_image_prompt(piece, color, style):
|
39 |
return f"A {style} outfit featuring a {color} {piece} styled with complementary clothing items and accessories. Modern, fashionable, and cohesive."
|
40 |
|
41 |
+
# Function to create outfit image using OpenAI's DALL-E (updated for version 1.0.0)
|
42 |
def create_outfit_image(prompt):
|
43 |
response = openai.Image.create(
|
44 |
+
model="dall-e", # Use the 'dall-e' model for image generation
|
45 |
prompt=prompt,
|
46 |
n=1,
|
47 |
size="1024x1024"
|
48 |
)
|
49 |
+
return response['data'][0]['url']
|
50 |
|
51 |
# Streamlit UI
|
52 |
def main():
|