JahDaGanj commited on
Commit
d04dee9
·
verified ·
1 Parent(s): 492151d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+ import os
4
+
5
+ # Stelle sicher, dass FashionMatrix geklont ist
6
+ if not os.path.exists("FashionMatrix"):
7
+ subprocess.run(["git", "clone", "https://github.com/Zheng-Chong/FashionMatrix.git"])
8
+
9
+ def run_fashionmatrix(image, cloth):
10
+ # Input-Dateien speichern
11
+ os.makedirs("inputs", exist_ok=True)
12
+ image_path = "inputs/input_image.jpg"
13
+ cloth_path = "inputs/input_cloth.jpg"
14
+ image.save(image_path)
15
+ cloth.save(cloth_path)
16
+
17
+ # Beispiel: Demo-Skript von FashionMatrix aufrufen
18
+ output_path = "output/result.jpg"
19
+ os.makedirs("output", exist_ok=True)
20
+
21
+ # ⚠️ Hier musst du ggf. das richtige Inferenz-Skript aus dem Repo aufrufen
22
+ subprocess.run([
23
+ "python", "FashionMatrix/demo.py",
24
+ "--image", image_path,
25
+ "--cloth", cloth_path,
26
+ "--output", output_path
27
+ ])
28
+
29
+ return output_path
30
+
31
+ demo = gr.Interface(
32
+ fn=run_fashionmatrix,
33
+ inputs=[gr.Image(type="pil"), gr.Image(type="pil")],
34
+ outputs=gr.Image(type="pil"),
35
+ title="👗 FashionMatrix Try-On",
36
+ description="Ziehe virtuelle Kleidung mit FashionMatrix direkt im Browser an!"
37
+ )
38
+
39
+ if __name__ == "__main__":
40
+ demo.launch()