fanboyd13 commited on
Commit
eff5095
·
verified ·
1 Parent(s): dc2cef4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +38 -0
  2. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from pathlib import Path
4
+ from PIL import Image
5
+ import shutil
6
+
7
+ # Folders & paths
8
+ BASE_DIR = Path(__file__).parent
9
+ UPLOAD_DIR = BASE_DIR / "uploads"
10
+ RESULT_DIR = BASE_DIR / "result"
11
+ DATA_DIR = BASE_DIR / "DATA_DIR"
12
+
13
+ UPLOAD_DIR.mkdir(exist_ok=True)
14
+ RESULT_DIR.mkdir(exist_ok=True)
15
+ DATA_DIR.mkdir(exist_ok=True)
16
+
17
+ # Dummy image in DATA_DIR
18
+ dummy_image_path = DATA_DIR / "dummy_image.png"
19
+ if not dummy_image_path.exists():
20
+ Image.new("RGB", (768, 1024), (200, 200, 200)).save(dummy_image_path)
21
+
22
+ # Dummy Try-On Function
23
+ def run_tryon(image: Image.Image):
24
+ input_path = UPLOAD_DIR / "input.png"
25
+ image.save(input_path)
26
+ output_path = RESULT_DIR / "output.png"
27
+ shutil.copy(dummy_image_path, output_path)
28
+ return output_path
29
+
30
+ iface = gr.Interface(
31
+ fn=run_tryon,
32
+ inputs=gr.Image(type="pil"),
33
+ outputs=gr.Image(type="pil"),
34
+ title="V-Try AI Try-On",
35
+ description="Upload a shirt or outfit to see the try-on result. Powered by IDM-VTON (dummy)."
36
+ )
37
+
38
+ iface.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio==3.39.0
2
+ Pillow
3
+ torch
4
+ opencv-python
5
+ accelerate
6
+ shutil