Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,60 +97,91 @@ custom_theme = gr.themes.Monochrome(
|
|
| 97 |
font=[gr.themes.GoogleFont("Montserrat"), "ui-sans-serif", "system-ui", "sans-serif"]
|
| 98 |
)
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
gr.HTML("""
|
| 102 |
-
<div style="text-align: center; padding: 20px;">
|
| 103 |
-
<h1
|
| 104 |
-
<p style="color:
|
|
|
|
| 105 |
</div>
|
| 106 |
""")
|
| 107 |
|
| 108 |
with gr.Tabs():
|
| 109 |
|
| 110 |
# --- TAB 1: Classic Search by Image ---
|
| 111 |
-
with gr.TabItem("🖼️
|
| 112 |
-
gr.Markdown("Upload an inspiration photo to instantly discover visually and stylistically similar rooms
|
| 113 |
with gr.Row():
|
| 114 |
with gr.Column(scale=1):
|
| 115 |
-
image_input = gr.Image(label="
|
| 116 |
-
img_submit_btn = gr.Button("
|
| 117 |
|
| 118 |
with gr.Column(scale=2):
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
-
img_rec1 = gr.Image(label="Top Match")
|
| 122 |
-
img_score1 = gr.Textbox(label="Confidence", interactive=False)
|
| 123 |
with gr.Column():
|
| 124 |
-
img_rec2 = gr.Image(label="2nd Match")
|
| 125 |
-
img_score2 = gr.Textbox(label="Confidence", interactive=False)
|
| 126 |
with gr.Column():
|
| 127 |
-
img_rec3 = gr.Image(label="3rd Match")
|
| 128 |
-
img_score3 = gr.Textbox(label="Confidence", interactive=False)
|
| 129 |
|
| 130 |
img_submit_btn.click(
|
| 131 |
fn=search_by_image, inputs=[image_input],
|
| 132 |
outputs=[img_rec1, img_score1, img_rec2, img_score2, img_rec3, img_score3]
|
| 133 |
)
|
| 134 |
|
| 135 |
-
# --- TAB 2: Fast Text Search
|
| 136 |
-
with gr.TabItem("🔍
|
| 137 |
-
gr.Markdown("Describe a room
|
| 138 |
with gr.Row():
|
| 139 |
with gr.Column(scale=1):
|
| 140 |
-
fast_text_input = gr.Textbox(label="
|
| 141 |
-
fast_txt_submit_btn = gr.Button("
|
| 142 |
|
| 143 |
with gr.Column(scale=2):
|
| 144 |
with gr.Row():
|
| 145 |
with gr.Column():
|
| 146 |
-
ft_rec1 = gr.Image(label="Top Match")
|
| 147 |
-
ft_score1 = gr.Textbox(label="Confidence", interactive=False)
|
| 148 |
with gr.Column():
|
| 149 |
-
ft_rec2 = gr.Image(label="2nd Match")
|
| 150 |
-
ft_score2 = gr.Textbox(label="Confidence", interactive=False)
|
| 151 |
with gr.Column():
|
| 152 |
-
ft_rec3 = gr.Image(label="3rd Match")
|
| 153 |
-
ft_score3 = gr.Textbox(label="Confidence", interactive=False)
|
| 154 |
|
| 155 |
fast_txt_submit_btn.click(
|
| 156 |
fn=search_by_text_only, inputs=[fast_text_input],
|
|
@@ -158,29 +189,38 @@ with gr.Blocks(theme=custom_theme) as demo:
|
|
| 158 |
)
|
| 159 |
|
| 160 |
# --- TAB 3: Advanced GenAI Search ---
|
| 161 |
-
with gr.TabItem("✨ AI
|
| 162 |
-
gr.Markdown("
|
| 163 |
with gr.Row():
|
| 164 |
with gr.Column(scale=1):
|
| 165 |
text_input = gr.Textbox(label="Concept Description", placeholder="e.g., A cozy modern living room with large windows...", lines=3)
|
| 166 |
-
txt_submit_btn = gr.Button("Generate
|
| 167 |
-
gen_output = gr.Image(label="
|
| 168 |
|
| 169 |
with gr.Column(scale=2):
|
| 170 |
with gr.Row():
|
| 171 |
with gr.Column():
|
| 172 |
-
txt_rec1 = gr.Image(label="Top Match")
|
| 173 |
-
txt_score1 = gr.Textbox(label="Confidence", interactive=False)
|
| 174 |
with gr.Column():
|
| 175 |
-
txt_rec2 = gr.Image(label="2nd Match")
|
| 176 |
-
txt_score2 = gr.Textbox(label="Confidence", interactive=False)
|
| 177 |
with gr.Column():
|
| 178 |
-
txt_rec3 = gr.Image(label="3rd Match")
|
| 179 |
-
txt_score3 = gr.Textbox(label="Confidence", interactive=False)
|
| 180 |
|
| 181 |
txt_submit_btn.click(
|
| 182 |
fn=generate_and_recommend, inputs=[text_input],
|
| 183 |
outputs=[gen_output, txt_rec1, txt_score1, txt_rec2, txt_score2, txt_rec3, txt_score3]
|
| 184 |
)
|
| 185 |
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
font=[gr.themes.GoogleFont("Montserrat"), "ui-sans-serif", "system-ui", "sans-serif"]
|
| 98 |
)
|
| 99 |
|
| 100 |
+
premium_css = """
|
| 101 |
+
.gradio-container {
|
| 102 |
+
background-color: #FAFAFA;
|
| 103 |
+
}
|
| 104 |
+
.image-container img {
|
| 105 |
+
border-radius: 8px;
|
| 106 |
+
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
|
| 107 |
+
}
|
| 108 |
+
.image-container img:hover {
|
| 109 |
+
transform: scale(1.03);
|
| 110 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.15);
|
| 111 |
+
}
|
| 112 |
+
button.primary {
|
| 113 |
+
background: linear-gradient(135deg, #1f1f1f, #3b3b3b) !important;
|
| 114 |
+
border: none !important;
|
| 115 |
+
transition: all 0.3s ease !important;
|
| 116 |
+
}
|
| 117 |
+
button.primary:hover {
|
| 118 |
+
transform: translateY(-2px) !important;
|
| 119 |
+
box-shadow: 0 8px 15px rgba(0,0,0,0.2) !important;
|
| 120 |
+
}
|
| 121 |
+
.visionary-title {
|
| 122 |
+
background: -webkit-linear-gradient(45deg, #111, #666);
|
| 123 |
+
-webkit-background-clip: text;
|
| 124 |
+
-webkit-text-fill-color: transparent;
|
| 125 |
+
font-weight: 300;
|
| 126 |
+
letter-spacing: 4px;
|
| 127 |
+
}
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
with gr.Blocks(theme=custom_theme, css=premium_css) as demo:
|
| 131 |
gr.HTML("""
|
| 132 |
+
<div style="text-align: center; padding: 40px 20px 20px 20px;">
|
| 133 |
+
<h1 class="visionary-title">V I S I O N A R Y</h1>
|
| 134 |
+
<p style="color: #777; font-size: 1.1em; font-weight: 300; margin-top: 10px;">AI-Powered Interior Architecture & Design Engine</p>
|
| 135 |
+
<div style="width: 50px; height: 2px; background-color: #ddd; margin: 20px auto;"></div>
|
| 136 |
</div>
|
| 137 |
""")
|
| 138 |
|
| 139 |
with gr.Tabs():
|
| 140 |
|
| 141 |
# --- TAB 1: Classic Search by Image ---
|
| 142 |
+
with gr.TabItem("🖼️ Image Search"):
|
| 143 |
+
gr.Markdown("<p style='text-align:center; margin-bottom: 20px;'>Upload an inspiration photo to instantly discover visually and stylistically similar rooms.</p>")
|
| 144 |
with gr.Row():
|
| 145 |
with gr.Column(scale=1):
|
| 146 |
+
image_input = gr.Image(label="Inspiration Source", type="pil", elem_classes="image-container")
|
| 147 |
+
img_submit_btn = gr.Button("Analyze & Match Vectors", variant="primary")
|
| 148 |
|
| 149 |
with gr.Column(scale=2):
|
| 150 |
with gr.Row():
|
| 151 |
with gr.Column():
|
| 152 |
+
img_rec1 = gr.Image(label="Top Match", elem_classes="image-container")
|
| 153 |
+
img_score1 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 154 |
with gr.Column():
|
| 155 |
+
img_rec2 = gr.Image(label="2nd Match", elem_classes="image-container")
|
| 156 |
+
img_score2 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 157 |
with gr.Column():
|
| 158 |
+
img_rec3 = gr.Image(label="3rd Match", elem_classes="image-container")
|
| 159 |
+
img_score3 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 160 |
|
| 161 |
img_submit_btn.click(
|
| 162 |
fn=search_by_image, inputs=[image_input],
|
| 163 |
outputs=[img_rec1, img_score1, img_rec2, img_score2, img_rec3, img_score3]
|
| 164 |
)
|
| 165 |
|
| 166 |
+
# --- TAB 2: Fast Text Search ---
|
| 167 |
+
with gr.TabItem("🔍 Smart Text Search"):
|
| 168 |
+
gr.Markdown("<p style='text-align:center; margin-bottom: 20px;'>Describe a room. Our multi-modal vision engine will instantly search the catalog for matching designs.</p>")
|
| 169 |
with gr.Row():
|
| 170 |
with gr.Column(scale=1):
|
| 171 |
+
fast_text_input = gr.Textbox(label="Architectural Query", placeholder="e.g., A minimalist industrial bedroom with exposed brick...", lines=3)
|
| 172 |
+
fast_txt_submit_btn = gr.Button("Query Catalog", variant="primary")
|
| 173 |
|
| 174 |
with gr.Column(scale=2):
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column():
|
| 177 |
+
ft_rec1 = gr.Image(label="Top Match", elem_classes="image-container")
|
| 178 |
+
ft_score1 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 179 |
with gr.Column():
|
| 180 |
+
ft_rec2 = gr.Image(label="2nd Match", elem_classes="image-container")
|
| 181 |
+
ft_score2 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 182 |
with gr.Column():
|
| 183 |
+
ft_rec3 = gr.Image(label="3rd Match", elem_classes="image-container")
|
| 184 |
+
ft_score3 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 185 |
|
| 186 |
fast_txt_submit_btn.click(
|
| 187 |
fn=search_by_text_only, inputs=[fast_text_input],
|
|
|
|
| 189 |
)
|
| 190 |
|
| 191 |
# --- TAB 3: Advanced GenAI Search ---
|
| 192 |
+
with gr.TabItem("✨ AI Studio"):
|
| 193 |
+
gr.Markdown("<p style='text-align:center; margin-bottom: 20px;'>Our Generative AI will draft a concept from scratch, and find the closest real-world equivalents.</p>")
|
| 194 |
with gr.Row():
|
| 195 |
with gr.Column(scale=1):
|
| 196 |
text_input = gr.Textbox(label="Concept Description", placeholder="e.g., A cozy modern living room with large windows...", lines=3)
|
| 197 |
+
txt_submit_btn = gr.Button("Generate & Match Concept", variant="primary")
|
| 198 |
+
gen_output = gr.Image(label="Generated Concept", type="pil", elem_classes="image-container")
|
| 199 |
|
| 200 |
with gr.Column(scale=2):
|
| 201 |
with gr.Row():
|
| 202 |
with gr.Column():
|
| 203 |
+
txt_rec1 = gr.Image(label="Top Match", elem_classes="image-container")
|
| 204 |
+
txt_score1 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 205 |
with gr.Column():
|
| 206 |
+
txt_rec2 = gr.Image(label="2nd Match", elem_classes="image-container")
|
| 207 |
+
txt_score2 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 208 |
with gr.Column():
|
| 209 |
+
txt_rec3 = gr.Image(label="3rd Match", elem_classes="image-container")
|
| 210 |
+
txt_score3 = gr.Textbox(label="Semantic Confidence", interactive=False)
|
| 211 |
|
| 212 |
txt_submit_btn.click(
|
| 213 |
fn=generate_and_recommend, inputs=[text_input],
|
| 214 |
outputs=[gen_output, txt_rec1, txt_score1, txt_rec2, txt_score2, txt_rec3, txt_score3]
|
| 215 |
)
|
| 216 |
|
| 217 |
+
# Footer אלגנטי בסוף
|
| 218 |
+
gr.HTML("""
|
| 219 |
+
<div style="text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #eaeaea;">
|
| 220 |
+
<p style="color: #999; font-size: 0.8em; font-family: 'Montserrat', sans-serif;">© 2026 VISIONARY INTERIORS. POWERED BY STABLE DIFFUSION & CLIP.</p>
|
| 221 |
+
</div>
|
| 222 |
+
""")
|
| 223 |
+
|
| 224 |
+
demo.launch()
|
| 225 |
+
|
| 226 |
+
|