ritz26 commited on
Commit
87d0ba2
Β·
1 Parent(s): 9807323

Update the Frontend

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. templates/index.html +45 -39
app.py CHANGED
@@ -114,4 +114,4 @@ def index():
114
  if __name__ == '__main__':
115
 
116
  print("[INFO] Starting Flask server...")
117
- app.run(debug=true, host='0.0.0.0')
 
114
  if __name__ == '__main__':
115
 
116
  print("[INFO] Starting Flask server...")
117
+ app.run(debug=True, host='0.0.0.0')
templates/index.html CHANGED
@@ -11,53 +11,59 @@
11
 
12
  <h1 class="text-4xl font-bold text-blue-400 mb-10">Virtual Fashion Try-On</h1>
13
 
14
- <form action="/" method="post" enctype="multipart/form-data" class="w-full max-w-4xl bg-gray-800 rounded-2xl shadow-lg p-8 space-y-6">
15
 
16
- <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
17
- <!-- Person Image Upload -->
18
- <div>
19
- <h2 class="text-lg font-semibold mb-2">Upload your photo</h2>
20
- <label for="person_image" class="flex flex-col items-center justify-center border-2 border-dashed border-gray-600 rounded-xl p-6 hover:bg-gray-700 cursor-pointer relative">
21
- <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-gray-400 mb-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
22
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16v4m0 0h10m-10 0v-4m0 0h10m-10 0V5m0 0h10m-10 0H5m14 0h-2" />
23
- </svg>
24
- <p class="text-gray-400">Drag & drop or click to upload</p>
25
- <input id="person_image" type="file" name="person_image" class="hidden" required onchange="showFileName('person_image', 'person_filename')">
26
- </label>
27
- <p id="person_filename" class="text-green-400 text-sm mt-2 text-center"></p>
28
- </div>
 
 
 
29
 
30
- <!-- T-Shirt Image Upload -->
31
- <div>
32
- <h2 class="text-lg font-semibold mb-2">Upload garment image</h2>
33
- <label for="tshirt_image" class="flex flex-col items-center justify-center border-2 border-dashed border-gray-600 rounded-xl p-6 hover:bg-gray-700 cursor-pointer relative">
34
- <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-gray-400 mb-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
35
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16v4m0 0h10m-10 0v-4m0 0h10m-10 0V5m0 0h10m-10 0H5m14 0h-2" />
36
- </svg>
37
- <p class="text-gray-400">Drag & drop or click to upload</p>
38
- <input id="tshirt_image" type="file" name="tshirt_image" class="hidden" required onchange="showFileName('tshirt_image', 'tshirt_filename')">
39
- </label>
40
- <p id="tshirt_filename" class="text-green-400 text-sm mt-2 text-center"></p>
 
41
  </div>
42
- </div>
43
 
44
- <!-- Submit Button -->
45
- <div class="flex justify-center">
46
- <button type="submit" class="bg-pink-500 hover:bg-pink-600 text-white font-semibold py-3 px-8 rounded-xl shadow-md transition">
47
- πŸš€ Perform Virtual Try-On
48
- </button>
49
- </div>
50
 
51
- </form>
52
 
53
- {% if result_img %}
54
- <div class="w-full max-w-4xl mt-10 bg-gray-800 rounded-2xl shadow-lg p-8">
55
- <h2 class="text-2xl font-bold mb-6 text-center">πŸŽ‰ Your Virtual Try-On Result</h2>
56
- <div class="flex justify-center">
57
- <img src="{{ result_img }}" alt="Result Image">
 
 
58
  </div>
 
 
59
  </div>
60
- {% endif %}
61
 
62
  <script>
63
  function showFileName(inputId, filenameId) {
 
11
 
12
  <h1 class="text-4xl font-bold text-blue-400 mb-10">Virtual Fashion Try-On</h1>
13
 
14
+ <div class="flex flex-col md:flex-row gap-10 w-full max-w-6xl">
15
 
16
+ <!-- LEFT: Input Form -->
17
+ <form action="/" method="post" enctype="multipart/form-data" class="w-full md:w-1/2 bg-gray-800 rounded-2xl shadow-lg p-8 space-y-6">
18
+
19
+ <div class="grid grid-cols-1 gap-8">
20
+ <!-- Person Image Upload -->
21
+ <div>
22
+ <h2 class="text-lg font-semibold mb-2">Upload your photo</h2>
23
+ <label for="person_image" class="flex flex-col items-center justify-center border-2 border-dashed border-gray-600 rounded-xl p-6 hover:bg-gray-700 cursor-pointer">
24
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-gray-400 mb-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
25
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16v4m0 0h10m-10 0v-4m0 0h10m-10 0V5m0 0h10m-10 0H5m14 0h-2" />
26
+ </svg>
27
+ <p class="text-gray-400">Drag & drop or click to upload</p>
28
+ <input id="person_image" type="file" name="person_image" class="hidden" required onchange="showFileName('person_image', 'person_filename')">
29
+ </label>
30
+ <p id="person_filename" class="text-green-400 text-sm mt-2 text-center"></p>
31
+ </div>
32
 
33
+ <!-- T-Shirt Image Upload -->
34
+ <div>
35
+ <h2 class="text-lg font-semibold mb-2">Upload garment image</h2>
36
+ <label for="tshirt_image" class="flex flex-col items-center justify-center border-2 border-dashed border-gray-600 rounded-xl p-6 hover:bg-gray-700 cursor-pointer">
37
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-gray-400 mb-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
38
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16v4m0 0h10m-10 0v-4m0 0h10m-10 0V5m0 0h10m-10 0H5m14 0h-2" />
39
+ </svg>
40
+ <p class="text-gray-400">Drag & drop or click to upload</p>
41
+ <input id="tshirt_image" type="file" name="tshirt_image" class="hidden" required onchange="showFileName('tshirt_image', 'tshirt_filename')">
42
+ </label>
43
+ <p id="tshirt_filename" class="text-green-400 text-sm mt-2 text-center"></p>
44
+ </div>
45
  </div>
 
46
 
47
+ <!-- Submit Button -->
48
+ <div class="flex justify-center">
49
+ <button type="submit" class="bg-pink-500 hover:bg-pink-600 text-white font-semibold py-3 px-8 rounded-xl shadow-md transition">
50
+ πŸš€ Perform Virtual Try-On
51
+ </button>
52
+ </div>
53
 
54
+ </form>
55
 
56
+ <!-- RIGHT: Output -->
57
+ {% if result_img %}
58
+ <div class="w-full md:w-1/2 bg-gray-800 rounded-2xl shadow-lg p-8">
59
+ <h2 class="text-2xl font-bold mb-6 text-center">πŸŽ‰ Your Virtual Try-On Result</h2>
60
+ <div class="flex justify-center">
61
+ <img src="{{ result_img }}" alt="Result Image" class="rounded-xl">
62
+ </div>
63
  </div>
64
+ {% endif %}
65
+
66
  </div>
 
67
 
68
  <script>
69
  function showFileName(inputId, filenameId) {