prithivMLmods commited on
Commit
678f36c
1 Parent(s): 199da9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -15,18 +15,17 @@ import gradio as gr
15
  import os
16
  import spaces
17
 
 
 
18
  def swap_face(source_file, target_file):
19
  source_image = Image.fromarray(source_file)
20
  source_path = "input.jpg"
21
  source_image.save(source_path, format="JPEG", quality=95)
22
 
23
-
24
  output_path = "output.mp4"
25
 
26
  roop.globals.source_path = source_path
27
  roop.globals.target_path = target_file
28
-
29
-
30
 
31
  roop.globals.output_path = normalize_output_path(
32
  roop.globals.source_path, roop.globals.target_path, output_path
@@ -53,7 +52,12 @@ def swap_face(source_file, target_file):
53
  return os.path.join(os.getcwd(), output_path)
54
 
55
  app = gr.Interface(
56
- fn=swap_face, inputs=[gr.Image(), gr.Video()], outputs=[gr.Video()], description="Deep Fake",theme="bethecloud/storj_theme"
 
 
 
 
 
57
  )
58
 
59
- app.launch()
 
15
  import os
16
  import spaces
17
 
18
+
19
+ @spaces.GPU()
20
  def swap_face(source_file, target_file):
21
  source_image = Image.fromarray(source_file)
22
  source_path = "input.jpg"
23
  source_image.save(source_path, format="JPEG", quality=95)
24
 
 
25
  output_path = "output.mp4"
26
 
27
  roop.globals.source_path = source_path
28
  roop.globals.target_path = target_file
 
 
29
 
30
  roop.globals.output_path = normalize_output_path(
31
  roop.globals.source_path, roop.globals.target_path, output_path
 
52
  return os.path.join(os.getcwd(), output_path)
53
 
54
  app = gr.Interface(
55
+ fn=swap_face,
56
+ inputs=[gr.Image(), gr.Video()],
57
+ outputs=[gr.Video()],
58
+ description="Deep Fake",
59
+ theme="bethecloud/storj_theme",
60
+ max_queue_size=40 # Set the maximum queue size here
61
  )
62
 
63
+ app.launch()