Spaces:
Build error
Build error
Moibe
commited on
Commit
·
95cbdc8
1
Parent(s):
14bab5c
Remove Image Gallery, add final routes
Browse files
app.py
CHANGED
|
@@ -142,13 +142,16 @@ def greet(input1, input2):
|
|
| 142 |
path_foto = pathlib.Path(path_particular + "/temp/" + nom_video + "/")
|
| 143 |
print("Éste es el path foto: ", path_foto)
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
-
print("Esto es la lista de imagenes: ", images)
|
| 152 |
|
| 153 |
nombre_zip = nom_video + ".zip"
|
| 154 |
print("El nombre del zip será: ", nombre_zip)
|
|
@@ -157,24 +160,34 @@ def greet(input1, input2):
|
|
| 157 |
if modo == "video":
|
| 158 |
#Para video
|
| 159 |
path = pathlib.Path("result.mp4")
|
|
|
|
| 160 |
path_zip = pathlib.Path(nombre_zip)
|
|
|
|
| 161 |
print("Éste es el path para video:", path)
|
|
|
|
| 162 |
print("Y éste es el path para el zip: ", path_zip)
|
| 163 |
-
|
|
|
|
| 164 |
else:
|
| 165 |
#Para imagen
|
| 166 |
path = pathlib.Path("result.png")
|
| 167 |
print("Éste es el path para imagen:", path)
|
| 168 |
return path, images, images
|
|
|
|
|
|
|
| 169 |
|
| 170 |
#Así para imagenes
|
| 171 |
# demo = gr.Interface(
|
| 172 |
# fn=greet, inputs=[gr.Image(), gr.Image()], outputs=[gr.Image(), gr.Image()]
|
| 173 |
# )
|
| 174 |
|
| 175 |
-
#Así para video
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
demo = gr.Interface(
|
| 177 |
-
fn=greet, inputs=[gr.Image(), gr.Video()], outputs=[gr.Video(), gr.
|
| 178 |
)
|
| 179 |
|
| 180 |
demo.launch()
|
|
|
|
| 142 |
path_foto = pathlib.Path(path_particular + "/temp/" + nom_video + "/")
|
| 143 |
print("Éste es el path foto: ", path_foto)
|
| 144 |
|
| 145 |
+
#Éste es el segmento que crea la galería de imagenes, que por el momento no usaremos por rendimiento.
|
| 146 |
+
#Se reintegrará si agregamos interacción de poder borrar cada imagen desde la interfaz web.
|
| 147 |
+
|
| 148 |
+
# for filename in os.listdir(path_foto):
|
| 149 |
+
# if filename.endswith(".png"):
|
| 150 |
+
# path = os.path.join(path_foto, filename)
|
| 151 |
+
# image = Image.open(path)
|
| 152 |
+
# images.append(image)
|
| 153 |
|
| 154 |
+
# print("Esto es la lista de imagenes: ", images)
|
| 155 |
|
| 156 |
nombre_zip = nom_video + ".zip"
|
| 157 |
print("El nombre del zip será: ", nombre_zip)
|
|
|
|
| 160 |
if modo == "video":
|
| 161 |
#Para video
|
| 162 |
path = pathlib.Path("result.mp4")
|
| 163 |
+
path_abs = os.path.abspath(path)
|
| 164 |
path_zip = pathlib.Path(nombre_zip)
|
| 165 |
+
path_zip_abs = os.path.abspath(path_zip)
|
| 166 |
print("Éste es el path para video:", path)
|
| 167 |
+
print("Y su ruta absoluta es: ", path_abs)
|
| 168 |
print("Y éste es el path para el zip: ", path_zip)
|
| 169 |
+
print("Y su ruta absoluta es: ", path_zip_abs)
|
| 170 |
+
return path, nombre_zip
|
| 171 |
else:
|
| 172 |
#Para imagen
|
| 173 |
path = pathlib.Path("result.png")
|
| 174 |
print("Éste es el path para imagen:", path)
|
| 175 |
return path, images, images
|
| 176 |
+
|
| 177 |
+
print("Listo! Gracias!")
|
| 178 |
|
| 179 |
#Así para imagenes
|
| 180 |
# demo = gr.Interface(
|
| 181 |
# fn=greet, inputs=[gr.Image(), gr.Image()], outputs=[gr.Image(), gr.Image()]
|
| 182 |
# )
|
| 183 |
|
| 184 |
+
#Así para video y 3 outputs: Video, Galería y Archivo Zip.
|
| 185 |
+
# demo = gr.Interface(
|
| 186 |
+
# fn=greet, inputs=[gr.Image(), gr.Video()], outputs=[gr.Video(), gr.Gallery(), gr.File()]
|
| 187 |
+
# )
|
| 188 |
+
|
| 189 |
demo = gr.Interface(
|
| 190 |
+
fn=greet, inputs=[gr.Image(), gr.Video()], outputs=[gr.Video(), gr.File()]
|
| 191 |
)
|
| 192 |
|
| 193 |
demo.launch()
|