Moibe commited on
Commit
f2c9245
1 Parent(s): 6896df3

Add PIL conversion

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,9 +1,26 @@
1
  import gradio as gr
 
2
 
3
  def greet(input1, input2):
4
  print("Imprimiendo en Consola")
5
  print("Ésto es input1: ", input1)
6
  print("Ésto es input2: ", input2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  return input1
8
 
9
  #def carga_consola():
@@ -22,7 +39,7 @@ def greet(input1, input2):
22
  # btn.click(greet, inputs=[gr.Image(), gr.Image()], outputs="image")
23
 
24
  demo = gr.Interface(
25
- fn=greet, inputs=[gr.Video(), gr.Video()], outputs="video"
26
  )
27
 
28
  demo.launch()
 
1
  import gradio as gr
2
+ from PIL import Image
3
 
4
  def greet(input1, input2):
5
  print("Imprimiendo en Consola")
6
  print("Ésto es input1: ", input1)
7
  print("Ésto es input2: ", input2)
8
+
9
+ #Aquí voy a poner como lo maneja roop en hf.
10
+ #https://huggingface.co/spaces/ezioruan/roop/blob/main/app.py
11
+
12
+ source_path = "input.jpg"
13
+ target_path = "target.jpg"
14
+
15
+ source_image = Image.fromarray(input1)
16
+ source_image.save(source_path)
17
+ target_image = Image.fromarray(input2)
18
+ target_image.save(target_path)
19
+
20
+ print("source_path: ", source_path)
21
+ print("target_path: ", target_path)
22
+
23
+
24
  return input1
25
 
26
  #def carga_consola():
 
39
  # btn.click(greet, inputs=[gr.Image(), gr.Image()], outputs="image")
40
 
41
  demo = gr.Interface(
42
+ fn=greet, inputs=[gr.Image(), gr.Image()], outputs="image"
43
  )
44
 
45
  demo.launch()