Skip to content

Commit

Permalink
proyecto actualizado
Browse files Browse the repository at this point in the history
  • Loading branch information
lriveraBanco committed Apr 28, 2024
1 parent 89f5669 commit 5d6d2c5
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 29 deletions.
14 changes: 7 additions & 7 deletions roop/Frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ def upload():

# Guardar la imagen en una carpeta específica con el nombre del personaje
character_name = {
1: 'Hulk',
2: 'Black Widow',
3: 'Captain America',
4: 'Captain Marvel',
5: 'Hawkeye',
6: 'Scarlet Witch'
1: 'Doctor_Strange',
2: 'Wanda',
3: 'Captain_America',
4: 'Captain_Marvel',
5: 'Spiderman',
6: 'Wonder_Woman'
}.get(button_number, 'Unknown')

img_name = f"{character_name}.png"
img_path = os.path.join('roop/images/', img_name)
img_path = os.path.join('/content/Proyecto_ia/roop/images/', img_name)
with open(img_path, 'wb') as img_file:
img_file.write(img_bytes)
flash(f"Imagen guardada correctamente", "success")
Expand Down
Binary file removed roop/Frontend/static/images/Black-Widow.jpg
Binary file not shown.
Binary file added roop/Frontend/static/images/Wanda.webp
Binary file not shown.
Binary file added roop/Frontend/static/images/aquaman.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added roop/Frontend/static/images/doctor.webp
Binary file not shown.
Binary file removed roop/Frontend/static/images/hawkeye.jpg
Binary file not shown.
Binary file removed roop/Frontend/static/images/hulk.jpg
Binary file not shown.
Binary file removed roop/Frontend/static/images/ironman.webp
Binary file not shown.
Binary file added roop/Frontend/static/images/mujer-maravilla.webp
Binary file not shown.
Binary file removed roop/Frontend/static/images/scarlet.jpg
Binary file not shown.
Binary file added roop/Frontend/static/images/spiderman.webp
Binary file not shown.
43 changes: 21 additions & 22 deletions roop/Frontend/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,77 +40,76 @@
<div class="slide">


<div class="item" style="background-image: url(static/images/hulk.jpg);">
<div class="item" style="background-image: url(static/images/doctor.webp);">
<div class="content">
<div class="name">Hulk</div>
<div class="name">Doctor Strange</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-1" data-name="Hulk">Tomar Foto</button>
<button id="capture-btn-1" data-name="Doctor_Strange">Tomar Foto</button>
<button id="close-btn-1" style="display: none;">Cerrar</button>
<canvas id="canvas-1" style="display: none;"></canvas>
<video id="video-1" style="display: none;"></video>
<button id="transform-btn-1">Transformar</button>
<button id="transform-btn-1" data-name="Doctor_Strange" data-video="Doctor_Strange.mp4">Transformar</button>
</div>
</div>
<div class="item" style="background-image: url(static/images/Black-Widow.jpg);">
<div class="item" style="background-image: url(static/images/Wanda.webp);">
<div class="content">
<div class="name">Black Widow</div>
<div class="name">Wanda</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-2" data-name="Black Widow">Tomar Foto</button>
<button id="capture-btn-2" data-name="Wanda">Tomar Foto</button>
<button id="close-btn-2" style="display: none;">Cerrar</button>
<canvas id="canvas-2" style="display: none;"></canvas>
<video id="video-2" style="display: none;"></video>
<button id="transform-btn-2">Transformar</button>
<button id="transform-btn-2" data-name="Wanda" data-video="Wanda.mp4">Transformar</button>
</div>
</div>
<div class="item" style="background-image: url(static/images/cap.webp);">
<div class="content">
<div class="name">Captain America</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-3" data-name ="Captain America">Tomar Foto</button>
<button id="capture-btn-3" data-name ="Captain_America">Tomar Foto</button>
<button id="close-btn-3" style="display: none;">Cerrar</button>
<canvas id="canvas-3" style="display: none;"></canvas>
<video id="video-3" style="display: none;"></video>
<button id="transform-btn-3">Transformar</button>
<button id="transform-btn-3" data-name="Captain_America" data-video="Captain_America.mp4">Transformar</button>
</div>
</div>
<div class="item" style="background-image: url(static/images/captain.webp);">
<div class="content">
<div class="name">Captain Marvel</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-4" data-name="Captain Marvel">Tomar Foto</button>
<button id="capture-btn-4" data-name="Captain_Marvel">Tomar Foto</button>
<button id="close-btn-4" style="display: none;">Cerrar</button>
<canvas id="canvas-4" style="display: none;"></canvas>
<video id="video-4" style="display: none;"></video>
<button id="transform-btn-4">Transformar</button>
<button id="transform-btn-4" data-name="Captain_Marvel" data-video="Captain_Marvel.mp4">Transformar</button>
</div>
</div>
<div class="item" style="background-image: url(static/images/hawkeye.jpg);">
<div class="item" style="background-image: url(static/images/Spiderman.webp);">
<div class="content">
<div class="name">Hawkeye</div>
<div class="name">Spiderman</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-5" data-name="Hawkeye">Tomar Foto</button>
<button id="capture-btn-5" data-name="Spiderman">Tomar Foto</button>
<button id="close-btn-5" style="display: none;">Cerrar</button>
<canvas id="canvas-5" style="display: none;"></canvas>
<video id="video-5" style="display: none;"></video>
<button id="transform-btn-5">Transformar</button>
<button id="transform-btn-5" data-name="Spiderman" data-video="Spiderman.mp4">Transformar</button>
</div>
</div>
<div class="item" style="background-image: url(static/images/scarlet.jpg);">
<div class="item" style="background-image: url(static/images/mujer-maravilla.webp);">
<div class="content">
<div class="name">Scarlet Witch</div>
<div class="name">Wonder Woman</div>
<div class="des">¿Que tanto te pareces a tu superheroe favorito?
</div>
<button id="capture-btn-6" data-name="Scarlet Witch">Tomar Foto</button>
<button id="capture-btn-6" data-name="Wonder_Woman">Tomar Foto</button>
<button id="close-btn-6" style="display: none;">Cerrar</button>
<canvas id="canvas-6" style="display: none;"></canvas>
<video id="video-6" style="display: none;"></video>
<button id="transform-btn-6">Transformar</button>

<button id="transform-btn-6" data-name="Wonder_Woman" data-video="Wonder_Woman.mp4">Transformar</button>
</div>
</div>

Expand Down Expand Up @@ -213,7 +212,7 @@

transformBtn.addEventListener('click', () => {
// Ejecutar el comando de transformación
const command = `%cd "/content/Proyecto_ia" && python run.py -s "/content/Proyecto_ia/roop/images/${characterName}.png" -t "/content/Proyecto_ia/roop/videos/${characterVideo}" -o "resultado.mp4" --keep-frames --keep-fps --temp-frame-quality 1 --output-video-quality 1 --execution-provider cuda --frame-processor face_swapper face_enhancer`;
const command = `cd "/content/Proyecto_ia" && python run.py -s "/content/Proyecto_ia/roop/images/${characterName}.png" -t "/content/Proyecto_ia/roop/videos/${characterVideo}.mp4" -o "resultados/resultado.mp4" --keep-frames --keep-fps --temp-frame-quality 1 --output-video-quality 1 --execution-provider cuda --frame-processor face_swapper face_enhancer`;
fetch('/transform', {
method: 'POST',
body: JSON.stringify({ command: command }),
Expand Down
Binary file removed roop/images/Black Widow.png
Binary file not shown.
Binary file removed roop/images/Captain America.png
Binary file not shown.
Binary file removed roop/images/foto.png
Binary file not shown.
Binary file removed roop/videos/04.mp4
Binary file not shown.
Binary file added roop/videos/Aquaman.MP4
Binary file not shown.
Binary file added roop/videos/Captain_America.mp4
Binary file not shown.
Binary file added roop/videos/Captain_Marvel.mp4
Binary file not shown.
Binary file added roop/videos/Doctor_Strange.mp4
Binary file not shown.
Binary file added roop/videos/Spiderman.mp4
Binary file not shown.
Binary file added roop/videos/Wanda.mp4
Binary file not shown.
Binary file added roop/videos/Wonder_Woman.mp4
Binary file not shown.
Binary file removed roop/videos/video.mp4
Binary file not shown.

0 comments on commit 5d6d2c5

Please sign in to comment.