Spaces:
Runtime error
Runtime error
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Virtual Try-On</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| background-color: #f5f5f5; | |
| } | |
| .upload-container { | |
| background-color: white; | |
| padding: 30px; | |
| border-radius: 10px; | |
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | |
| } | |
| h1 { | |
| color: #333; | |
| text-align: center; | |
| } | |
| .form-group { | |
| margin-bottom: 20px; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 8px; | |
| font-weight: bold; | |
| } | |
| input[type="file"] { | |
| width: 100%; | |
| padding: 10px; | |
| border: 1px solid #ddd; | |
| border-radius: 4px; | |
| } | |
| button { | |
| background-color: #4CAF50; | |
| color: white; | |
| padding: 12px 20px; | |
| border: none; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| font-size: 16px; | |
| width: 100%; | |
| } | |
| button:hover { | |
| background-color: #45a049; | |
| } | |
| .preview-container { | |
| display: flex; | |
| justify-content: space-between; | |
| margin-top: 20px; | |
| } | |
| .preview-box { | |
| width: 48%; | |
| text-align: center; | |
| } | |
| .preview-img { | |
| max-width: 100%; | |
| max-height: 300px; | |
| border: 1px dashed #ccc; | |
| margin-top: 10px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="upload-container"> | |
| <h1>Virtual Try-On</h1> | |
| <form action="/upload" method="POST" enctype="multipart/form-data" id="uploadForm"> | |
| <div class="form-group"> | |
| <label for="person_image">Upload Your Photo:</label> | |
| <input type="file" id="person_image" name="person_image" accept="image/*" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="garment_image">Upload Garment Photo:</label> | |
| <input type="file" id="garment_image" name="garment_image" accept="image/*" required> | |
| </div> | |
| <button type="submit">Try It On!</button> | |
| </form> | |
| <div class="preview-container"> | |
| <div class="preview-box"> | |
| <h3>Your Photo</h3> | |
| <img id="personPreview" class="preview-img" src="#" alt="Your photo preview" style="display: none;"> | |
| </div> | |
| <div class="preview-box"> | |
| <h3>Garment Photo</h3> | |
| <img id="garmentPreview" class="preview-img" src="#" alt="Garment preview" style="display: none;"> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Preview images before upload | |
| document.getElementById('person_image').addEventListener('change', function (e) { | |
| const preview = document.getElementById('personPreview'); | |
| const file = e.target.files[0]; | |
| if (file) { | |
| preview.style.display = 'block'; | |
| preview.src = URL.createObjectURL(file); | |
| } | |
| }); | |
| document.getElementById('garment_image').addEventListener('change', function (e) { | |
| const preview = document.getElementById('garmentPreview'); | |
| const file = e.target.files[0]; | |
| if (file) { | |
| preview.style.display = 'block'; | |
| preview.src = URL.createObjectURL(file); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |