Spaces:
Running
Running
Update index.html
Browse files- index.html +153 -46
index.html
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>مشاور مبلمان</title>
|
| 7 |
-
<script type="importmap">
|
| 8 |
-
{
|
| 9 |
-
"imports": {
|
| 10 |
-
"@gradio/lite": "https://cdn.jsdelivr.net/npm/@gradio/lite@0.4.2/dist/lite.js"
|
| 11 |
-
}
|
| 12 |
-
}
|
| 13 |
-
</script>
|
| 14 |
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite@0.4.2/dist/lite.css" />
|
| 15 |
<style>
|
| 16 |
body {
|
| 17 |
font-family: sans-serif;
|
|
@@ -35,34 +28,166 @@
|
|
| 35 |
text-align: center;
|
| 36 |
color: #2c3e50;
|
| 37 |
}
|
| 38 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
margin-top: 20px;
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
.tip {
|
| 42 |
-
background: #
|
| 43 |
padding: 15px;
|
| 44 |
border-radius: 10px;
|
| 45 |
margin-top: 20px;
|
| 46 |
text-align: center;
|
| 47 |
-
|
| 48 |
-
border: 2px dashed #dee2e6;
|
| 49 |
}
|
| 50 |
</style>
|
| 51 |
</head>
|
| 52 |
<body>
|
| 53 |
<div class="container">
|
| 54 |
<h1>🪑 مشاور هوشمند مبلمان</h1>
|
| 55 |
-
<p style="text-align:center; color:#6c757d;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
<
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
🪑 **نتیجه تحلیل مبلمان شما**
|
| 67 |
|
| 68 |
📸 **نوع مبل:** مبل راحتی مدرن
|
|
@@ -73,28 +198,10 @@
|
|
| 73 |
💡 **نکات طراحی:**
|
| 74 |
• با دیوارهای روشن هماهنگ کنید
|
| 75 |
• از کوسنهای متضاد استفاده کنید
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
inputs=gr.Image(
|
| 81 |
-
label="📸 برای آپلود اینجا کلیک کنید",
|
| 82 |
-
type="pil",
|
| 83 |
-
sources=["upload"],
|
| 84 |
-
interactive=True
|
| 85 |
-
),
|
| 86 |
-
outputs=gr.Markdown(),
|
| 87 |
-
title="🪑 مشاور مبلمان",
|
| 88 |
-
description="عکس مبل را آپلود کنید"
|
| 89 |
-
)
|
| 90 |
-
|
| 91 |
-
demo.launch()
|
| 92 |
-
</gradio-lite>
|
| 93 |
-
</div>
|
| 94 |
-
|
| 95 |
-
<div class="tip">
|
| 96 |
-
💡 راهنما: روی جعبه بالا کلیک کنید یا عکس را بکشید و در آن رها کنید
|
| 97 |
-
</div>
|
| 98 |
-
</div>
|
| 99 |
</body>
|
| 100 |
-
</html>
|
|
|
|
|
|
| 1 |
+
```html
|
| 2 |
<!DOCTYPE html>
|
| 3 |
<html>
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
<title>مشاور مبلمان</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<style>
|
| 9 |
body {
|
| 10 |
font-family: sans-serif;
|
|
|
|
| 28 |
text-align: center;
|
| 29 |
color: #2c3e50;
|
| 30 |
}
|
| 31 |
+
.upload-area {
|
| 32 |
+
border: 3px dashed #667eea;
|
| 33 |
+
border-radius: 20px;
|
| 34 |
+
padding: 30px;
|
| 35 |
+
text-align: center;
|
| 36 |
+
margin: 20px 0;
|
| 37 |
+
background: #f8f9fa;
|
| 38 |
+
cursor: pointer;
|
| 39 |
+
transition: all 0.3s;
|
| 40 |
+
}
|
| 41 |
+
.upload-area:hover {
|
| 42 |
+
background: #e9ecef;
|
| 43 |
+
border-color: #764ba2;
|
| 44 |
+
}
|
| 45 |
+
.upload-area input[type="file"] {
|
| 46 |
+
display: none;
|
| 47 |
+
}
|
| 48 |
+
.upload-area label {
|
| 49 |
+
cursor: pointer;
|
| 50 |
+
font-size: 1.2rem;
|
| 51 |
+
color: #2c3e50;
|
| 52 |
+
}
|
| 53 |
+
.upload-area label span {
|
| 54 |
+
font-size: 3rem;
|
| 55 |
+
display: block;
|
| 56 |
+
}
|
| 57 |
+
#image-preview {
|
| 58 |
+
max-width: 100%;
|
| 59 |
+
max-height: 300px;
|
| 60 |
+
border-radius: 15px;
|
| 61 |
+
margin: 10px 0;
|
| 62 |
+
display: none;
|
| 63 |
+
}
|
| 64 |
+
.btn-analyze {
|
| 65 |
+
background: #667eea;
|
| 66 |
+
color: white;
|
| 67 |
+
border: none;
|
| 68 |
+
padding: 15px 40px;
|
| 69 |
+
border-radius: 50px;
|
| 70 |
+
font-size: 1.2rem;
|
| 71 |
+
cursor: pointer;
|
| 72 |
+
margin-top: 15px;
|
| 73 |
+
transition: all 0.3s;
|
| 74 |
+
width: 100%;
|
| 75 |
+
}
|
| 76 |
+
.btn-analyze:hover {
|
| 77 |
+
background: #764ba2;
|
| 78 |
+
transform: scale(1.02);
|
| 79 |
+
}
|
| 80 |
+
.result-box {
|
| 81 |
+
background: #f8f9fa;
|
| 82 |
+
padding: 20px;
|
| 83 |
+
border-radius: 15px;
|
| 84 |
margin-top: 20px;
|
| 85 |
+
white-space: pre-wrap;
|
| 86 |
+
font-family: monospace;
|
| 87 |
+
display: none;
|
| 88 |
}
|
| 89 |
.tip {
|
| 90 |
+
background: #fff3cd;
|
| 91 |
padding: 15px;
|
| 92 |
border-radius: 10px;
|
| 93 |
margin-top: 20px;
|
| 94 |
text-align: center;
|
| 95 |
+
border: 1px solid #ffc107;
|
|
|
|
| 96 |
}
|
| 97 |
</style>
|
| 98 |
</head>
|
| 99 |
<body>
|
| 100 |
<div class="container">
|
| 101 |
<h1>🪑 مشاور هوشمند مبلمان</h1>
|
| 102 |
+
<p style="text-align:center; color:#6c757d;">عکس مبل خود را انتخاب کنید</p>
|
| 103 |
+
|
| 104 |
+
<div class="upload-area" id="uploadArea">
|
| 105 |
+
<label for="fileInput">
|
| 106 |
+
<span>📸</span>
|
| 107 |
+
<br>
|
| 108 |
+
<strong>برای آپلود عکس کلیک کنید</strong>
|
| 109 |
+
<br>
|
| 110 |
+
<small>یا عکس را بکشید و اینجا رها کنید</small>
|
| 111 |
+
</label>
|
| 112 |
+
<input type="file" id="fileInput" accept="image/*">
|
| 113 |
+
</div>
|
| 114 |
|
| 115 |
+
<img id="image-preview" alt="پیشنمایش عکس">
|
| 116 |
+
|
| 117 |
+
<button class="btn-analyze" id="analyzeBtn">🔍 تحلیل کن</button>
|
| 118 |
+
|
| 119 |
+
<div class="result-box" id="resultBox">
|
| 120 |
+
🪑 نتیجه تحلیل شما اینجا نمایش داده میشود...
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
<div class="tip">
|
| 124 |
+
💡 نکته: روی جعبه بالا کلیک کنید و عکس مبل خود را انتخاب کنید
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<script>
|
| 129 |
+
const fileInput = document.getElementById('fileInput');
|
| 130 |
+
const uploadArea = document.getElementById('uploadArea');
|
| 131 |
+
const preview = document.getElementById('image-preview');
|
| 132 |
+
const analyzeBtn = document.getElementById('analyzeBtn');
|
| 133 |
+
const resultBox = document.getElementById('resultBox');
|
| 134 |
+
let selectedImage = null;
|
| 135 |
+
|
| 136 |
+
fileInput.addEventListener('change', function(e) {
|
| 137 |
+
const file = this.files[0];
|
| 138 |
+
if (file) {
|
| 139 |
+
const reader = new FileReader();
|
| 140 |
+
reader.onload = function(e) {
|
| 141 |
+
preview.src = e.target.result;
|
| 142 |
+
preview.style.display = 'block';
|
| 143 |
+
selectedImage = e.target.result;
|
| 144 |
+
resultBox.style.display = 'none';
|
| 145 |
+
};
|
| 146 |
+
reader.readAsDataURL(file);
|
| 147 |
+
}
|
| 148 |
+
});
|
| 149 |
+
|
| 150 |
+
uploadArea.addEventListener('dragover', function(e) {
|
| 151 |
+
e.preventDefault();
|
| 152 |
+
this.style.borderColor = '#764ba2';
|
| 153 |
+
this.style.background = '#e9ecef';
|
| 154 |
+
});
|
| 155 |
+
|
| 156 |
+
uploadArea.addEventListener('dragleave', function(e) {
|
| 157 |
+
e.preventDefault();
|
| 158 |
+
this.style.borderColor = '#667eea';
|
| 159 |
+
this.style.background = '#f8f9fa';
|
| 160 |
+
});
|
| 161 |
+
|
| 162 |
+
uploadArea.addEventListener('drop', function(e) {
|
| 163 |
+
e.preventDefault();
|
| 164 |
+
this.style.borderColor = '#667eea';
|
| 165 |
+
this.style.background = '#f8f9fa';
|
| 166 |
+
const file = e.dataTransfer.files[0];
|
| 167 |
+
if (file) {
|
| 168 |
+
const reader = new FileReader();
|
| 169 |
+
reader.onload = function(e) {
|
| 170 |
+
preview.src = e.target.result;
|
| 171 |
+
preview.style.display = 'block';
|
| 172 |
+
selectedImage = e.target.result;
|
| 173 |
+
resultBox.style.display = 'none';
|
| 174 |
+
};
|
| 175 |
+
reader.readAsDataURL(file);
|
| 176 |
+
}
|
| 177 |
+
});
|
| 178 |
+
|
| 179 |
+
uploadArea.addEventListener('click', function() {
|
| 180 |
+
fileInput.click();
|
| 181 |
+
});
|
| 182 |
+
|
| 183 |
+
analyzeBtn.addEventListener('click', function() {
|
| 184 |
+
if (!selectedImage) {
|
| 185 |
+
alert('⚠️ لطفاً ابتدا یک عکس انتخاب کنید!');
|
| 186 |
+
return;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
resultBox.style.display = 'block';
|
| 190 |
+
resultBox.innerHTML = `
|
| 191 |
🪑 **نتیجه تحلیل مبلمان شما**
|
| 192 |
|
| 193 |
📸 **نوع مبل:** مبل راحتی مدرن
|
|
|
|
| 198 |
💡 **نکات طراحی:**
|
| 199 |
• با دیوارهای روشن هماهنگ کنید
|
| 200 |
• از کوسنهای متضاد استفاده کنید
|
| 201 |
+
• نور گرم و غیرمستقیم انتخاب کنید
|
| 202 |
+
`;
|
| 203 |
+
});
|
| 204 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
</body>
|
| 206 |
+
</html>
|
| 207 |
+
```
|