Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,37 +16,97 @@ st.set_page_config(
|
|
16 |
# Custom CSS for better styling with Renesistech branding
|
17 |
st.markdown("""
|
18 |
<style>
|
|
|
19 |
.stApp {
|
20 |
-
max-width:
|
21 |
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
.upload-box {
|
24 |
-
border: 2px dashed #
|
25 |
-
border-radius:
|
26 |
-
padding:
|
27 |
text-align: center;
|
28 |
-
margin:
|
|
|
|
|
29 |
}
|
30 |
-
|
31 |
-
|
32 |
-
border-
|
33 |
-
padding: 20px;
|
34 |
-
margin: 20px 0;
|
35 |
background-color: #f8f9fa;
|
36 |
}
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
background-color: #ffffff;
|
39 |
-
|
40 |
-
margin-bottom: 30px;
|
41 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
42 |
-
text-align: center;
|
43 |
}
|
|
|
|
|
44 |
.renesistech-footer {
|
45 |
-
background
|
46 |
-
padding:
|
47 |
text-align: center;
|
48 |
-
border-top: 1px solid #
|
49 |
-
margin-top:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
</style>
|
52 |
""", unsafe_allow_html=True)
|
@@ -118,7 +178,13 @@ if st.button("Generate Try-On", type="primary"):
|
|
118 |
else:
|
119 |
try:
|
120 |
with st.spinner("🔄 Processing virtual try-on..."):
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
# Display result in a styled box
|
124 |
st.markdown("<div class='output-box'>", unsafe_allow_html=True)
|
|
|
16 |
# Custom CSS for better styling with Renesistech branding
|
17 |
st.markdown("""
|
18 |
<style>
|
19 |
+
/* Global Styles */
|
20 |
.stApp {
|
21 |
+
max-width: 1400px;
|
22 |
margin: 0 auto;
|
23 |
+
background-color: #ffffff;
|
24 |
+
font-family: 'Inter', sans-serif;
|
25 |
+
}
|
26 |
+
|
27 |
+
/* Header Styles */
|
28 |
+
.renesistech-header {
|
29 |
+
background: linear-gradient(to right, #f8f9fa, #ffffff);
|
30 |
+
padding: 2rem;
|
31 |
+
margin-bottom: 2rem;
|
32 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
33 |
+
text-align: center;
|
34 |
+
border-bottom: 1px solid #eaeaea;
|
35 |
+
}
|
36 |
+
|
37 |
+
/* Main Content Styles */
|
38 |
+
.stButton > button {
|
39 |
+
background-color: #007bff;
|
40 |
+
color: white;
|
41 |
+
padding: 0.75rem 2rem;
|
42 |
+
border-radius: 8px;
|
43 |
+
border: none;
|
44 |
+
font-weight: 600;
|
45 |
+
transition: all 0.3s ease;
|
46 |
}
|
47 |
+
|
48 |
+
.stButton > button:hover {
|
49 |
+
background-color: #0056b3;
|
50 |
+
transform: translateY(-2px);
|
51 |
+
}
|
52 |
+
|
53 |
+
/* Upload Box Styles */
|
54 |
.upload-box {
|
55 |
+
border: 2px dashed #e0e0e0;
|
56 |
+
border-radius: 12px;
|
57 |
+
padding: 2rem;
|
58 |
text-align: center;
|
59 |
+
margin: 1rem 0;
|
60 |
+
background-color: #fafafa;
|
61 |
+
transition: all 0.3s ease;
|
62 |
}
|
63 |
+
|
64 |
+
.upload-box:hover {
|
65 |
+
border-color: #007bff;
|
|
|
|
|
66 |
background-color: #f8f9fa;
|
67 |
}
|
68 |
+
|
69 |
+
/* Output Box Styles */
|
70 |
+
.output-box {
|
71 |
+
border: 1px solid #eaeaea;
|
72 |
+
border-radius: 12px;
|
73 |
+
padding: 2rem;
|
74 |
+
margin: 2rem 0;
|
75 |
background-color: #ffffff;
|
76 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
|
|
|
|
|
|
77 |
}
|
78 |
+
|
79 |
+
/* Footer Styles */
|
80 |
.renesistech-footer {
|
81 |
+
background: linear-gradient(to right, #f8f9fa, #ffffff);
|
82 |
+
padding: 2rem;
|
83 |
text-align: center;
|
84 |
+
border-top: 1px solid #eaeaea;
|
85 |
+
margin-top: 3rem;
|
86 |
+
}
|
87 |
+
|
88 |
+
/* Typography Improvements */
|
89 |
+
h1, h2, h3, .stMarkdown p {
|
90 |
+
color: #2c3e50;
|
91 |
+
letter-spacing: -0.5px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.stTextArea textarea {
|
95 |
+
border-radius: 8px;
|
96 |
+
border: 1px solid #eaeaea;
|
97 |
+
padding: 1rem;
|
98 |
+
font-size: 1rem;
|
99 |
+
}
|
100 |
+
|
101 |
+
.stTextArea textarea:focus {
|
102 |
+
border-color: #007bff;
|
103 |
+
box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
|
104 |
+
}
|
105 |
+
|
106 |
+
/* Image Display Improvements */
|
107 |
+
.stImage img {
|
108 |
+
border-radius: 12px;
|
109 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
110 |
}
|
111 |
</style>
|
112 |
""", unsafe_allow_html=True)
|
|
|
178 |
else:
|
179 |
try:
|
180 |
with st.spinner("🔄 Processing virtual try-on..."):
|
181 |
+
# Read the image data from the temporary files
|
182 |
+
with open(garment_url, 'rb') as f:
|
183 |
+
garment_data = f.read()
|
184 |
+
with open(person_url, 'rb') as f:
|
185 |
+
person_data = f.read()
|
186 |
+
|
187 |
+
output_path = virtual_try_on(garment_data, person_data, garment_desc)
|
188 |
|
189 |
# Display result in a styled box
|
190 |
st.markdown("<div class='output-box'>", unsafe_allow_html=True)
|