Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,6 +87,18 @@ def generate(
|
|
| 87 |
def root():
|
| 88 |
return "Welcome to the Fashion Outfit "
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
# Route pour l'API REST
|
| 91 |
@app.route('/api/run', methods=['POST'])
|
| 92 |
def run():
|
|
|
|
| 87 |
def root():
|
| 88 |
return "Welcome to the Fashion Outfit "
|
| 89 |
|
| 90 |
+
# Route pour récupérer l'image générée
|
| 91 |
+
@app.route('/api/get_image/<image_id>', methods=['GET'])
|
| 92 |
+
def get_image(image_id):
|
| 93 |
+
# Construire le chemin complet de l'image
|
| 94 |
+
image_path = f"{image_id}.png" # Assurez-vous que le nom de fichier correspond à celui que vous avez utilisé lors de la sauvegarde
|
| 95 |
+
|
| 96 |
+
# Renvoyer l'image
|
| 97 |
+
try:
|
| 98 |
+
return send_file(image_path, mimetype='image/png')
|
| 99 |
+
except FileNotFoundError:
|
| 100 |
+
return jsonify({'error': 'Image not found'}), 404
|
| 101 |
+
|
| 102 |
# Route pour l'API REST
|
| 103 |
@app.route('/api/run', methods=['POST'])
|
| 104 |
def run():
|