Spaces:
Paused
Paused
giorgio-caparvi
commited on
Commit
·
5457fbb
1
Parent(s):
7369bce
updated output path
Browse files- api/app.py +7 -4
api/app.py
CHANGED
@@ -11,7 +11,7 @@ app.template_folder = './templates'
|
|
11 |
|
12 |
print(f"Current working directory: {os.getcwd()}")
|
13 |
# Set the directory for the output images
|
14 |
-
output_dir = '/api/output'
|
15 |
image_filename = '03191_00.jpg'
|
16 |
|
17 |
@app.route('/')
|
@@ -26,7 +26,7 @@ def generate_design():
|
|
26 |
'--dataset_path', '/api/model/assets/data/vitonhd',
|
27 |
'--batch_size', '1',
|
28 |
'--mixed_precision', 'fp16',
|
29 |
-
'--output_dir',
|
30 |
'--save_name', 'generato_paired',
|
31 |
'--num_workers_test', '4',
|
32 |
'--sketch_cond_rate', '0.2',
|
@@ -40,12 +40,15 @@ def generate_design():
|
|
40 |
print(f"Command output: {result.stdout}")
|
41 |
print(f"Command errors: {result.stderr}")
|
42 |
#image_path = os.path.join(output_dir, image_filename)
|
43 |
-
image_path = "/api/output/generato_paired_paired/images/03191_00.jpg"
|
44 |
print("immagine creata")
|
|
|
|
|
|
|
45 |
# Check if the image was generated
|
46 |
if os.path.exists(image_path):
|
47 |
print("IMMAGINE CREATA")
|
48 |
-
return jsonify({"status": "success", "image_url": f"{output_dir}
|
49 |
else:
|
50 |
print("IMMAGINE NON CREATA")
|
51 |
return jsonify({"status": "error", "message": "Image generation failed"}), 500
|
|
|
11 |
|
12 |
print(f"Current working directory: {os.getcwd()}")
|
13 |
# Set the directory for the output images
|
14 |
+
output_dir = '/api/output/generato_paired_paired/images'
|
15 |
image_filename = '03191_00.jpg'
|
16 |
|
17 |
@app.route('/')
|
|
|
26 |
'--dataset_path', '/api/model/assets/data/vitonhd',
|
27 |
'--batch_size', '1',
|
28 |
'--mixed_precision', 'fp16',
|
29 |
+
'--output_dir', output_dir,
|
30 |
'--save_name', 'generato_paired',
|
31 |
'--num_workers_test', '4',
|
32 |
'--sketch_cond_rate', '0.2',
|
|
|
40 |
print(f"Command output: {result.stdout}")
|
41 |
print(f"Command errors: {result.stderr}")
|
42 |
#image_path = os.path.join(output_dir, image_filename)
|
43 |
+
image_path = output_dir#"/api/output/generato_paired_paired/images/03191_00.jpg"
|
44 |
print("immagine creata")
|
45 |
+
print(f"Directory Exists: {os.path.exists(output_dir)}")
|
46 |
+
print(f"Can Write: {os.access(output_dir, os.W_OK)}")
|
47 |
+
|
48 |
# Check if the image was generated
|
49 |
if os.path.exists(image_path):
|
50 |
print("IMMAGINE CREATA")
|
51 |
+
return jsonify({"status": "success", "image_url": f"{output_dir}"})
|
52 |
else:
|
53 |
print("IMMAGINE NON CREATA")
|
54 |
return jsonify({"status": "error", "message": "Image generation failed"}), 500
|