diff --git a/roop/Frontend/app.py b/roop/Frontend/app.py index 19880e8..f462b71 100644 --- a/roop/Frontend/app.py +++ b/roop/Frontend/app.py @@ -1,8 +1,12 @@ -from flask import Flask, render_template, request, redirect, url_for +from flask import Flask, render_template, request, redirect, url_for, jsonify, flash import os import base64 +import secrets +secret_key = secrets.token_hex(16) app = Flask(__name__) +app.secret_key = secret_key + captureCounter = 0 @app.route('/') @@ -34,16 +38,17 @@ def upload(): img_path = os.path.join('roop/images/', img_name) with open(img_path, 'wb') as img_file: img_file.write(img_bytes) + flash(f"Imagen guardada correctamente", "success") + return redirect(url_for('index')) - # Ejecutar el comando para procesar la imagen - if character_name == 'Unknown': - return redirect(url_for('index')) - - # Procesar la imagen con el comando específico - command = f"%cd '/content/roop' && python run.py -s '{character_name}.png' -t 'brad org.mp4' -o 'face_restored_video3.mp4' --keep-frames --keep-fps --temp-frame-quality 1 --output-video-quality 1 --execution-provider cuda --frame-processor face_swapper face_enhancer" - os.system(command) - return redirect(url_for('index')) +@app.route('/transform', methods=['POST']) +def transform(): + command = request.json.get('command') + if command: + os.system(command) + return jsonify({'message': 'Transformación completada'}) + return jsonify({'message': 'Error: comando de transformación no proporcionado'}), 400 if __name__ == '__main__': diff --git a/roop/Frontend/templates/index.html b/roop/Frontend/templates/index.html index 967c32e..dbb5a84 100644 --- a/roop/Frontend/templates/index.html +++ b/roop/Frontend/templates/index.html @@ -23,7 +23,18 @@ - + + + {% with messages = get_flashed_messages() %} + {% if messages %} + + {% endif %} + {% endwith %} +
@@ -94,11 +105,12 @@
Scarlet Witch
¿Que tanto te pareces a tu superheroe favorito?
- + +
@@ -108,11 +120,11 @@ -
- + + diff --git a/roop/images/Black Widow.png b/roop/images/Black Widow.png index f9b5d80..0ae05d6 100644 Binary files a/roop/images/Black Widow.png and b/roop/images/Black Widow.png differ diff --git a/roop/images/Captain America.png b/roop/images/Captain America.png new file mode 100644 index 0000000..a7a180e Binary files /dev/null and b/roop/images/Captain America.png differ