victorisgeek commited on
Commit
0688273
ยท
verified ยท
1 Parent(s): 4cc7985

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -48
app.py CHANGED
@@ -5,7 +5,7 @@ from dofaker import FaceSwapper, PoseSwapper
5
 
6
 
7
  def parse_args():
8
- parser = argparse.ArgumentParser(description='running face swap')
9
  parser.add_argument(
10
  '--inbrowser',
11
  help=
@@ -41,43 +41,43 @@ def swap_pose(input_path, target_path, use_enhancer, use_sr, scale):
41
  def main():
42
  args = parse_args()
43
 
44
- with gr.Blocks(title='DoFaker') as web_ui:
45
- gr.Markdown('DoFaker: Face Swap and pose swap web ui')
46
- with gr.Tab('FaceSwapper'):
47
- gr.Markdown('DoFaker: Face Swap Web UI')
48
- with gr.Tab('Image'):
49
  with gr.Row():
50
  with gr.Column():
51
- gr.Markdown('The source image to be swapped')
52
- image_input = gr.Image(type='filepath')
53
  with gr.Row():
54
  with gr.Column():
55
  gr.Markdown(
56
- 'target face included in source image')
57
- dst_face_image = gr.Image(type='filepath')
58
  with gr.Column():
59
  gr.Markdown(
60
- 'source face to replace target face')
61
- src_face_image = gr.Image(type='filepath')
62
 
63
  with gr.Column():
64
- output_image = gr.Image(type='filepath')
65
  use_enhancer = gr.Checkbox(
66
- label="face enhance",
67
- info="Whether use face enhance model.")
68
  with gr.Row():
69
  use_sr = gr.Checkbox(
70
- label="super resolution",
71
- info="Whether use image resolution model.")
72
  scale = gr.Number(
73
- value=1, label='image super resolution scale')
74
  with gr.Row():
75
  face_sim_thre = gr.Number(
76
  value=0.6,
77
- label='face similarity threshold',
78
  minimum=0.0,
79
  maximum=1.0)
80
- convert_button = gr.Button('Swap')
81
  convert_button.click(fn=swap_face,
82
  inputs=[
83
  image_input, dst_face_image,
@@ -85,41 +85,41 @@ def main():
85
  use_sr, scale, face_sim_thre
86
  ],
87
  outputs=[output_image],
88
- api_name='image swap')
89
 
90
- with gr.Tab('Video'):
91
  with gr.Row():
92
  with gr.Column():
93
- gr.Markdown('The source video to be swapped')
94
  video_input = gr.Video()
95
  with gr.Row():
96
  with gr.Column():
97
  gr.Markdown(
98
- 'target face included in source image')
99
  dst_face_image = gr.Image(type='filepath')
100
  with gr.Column():
101
  gr.Markdown(
102
- 'source face to replace target face')
103
  src_face_image = gr.Image(type='filepath')
104
 
105
  with gr.Column():
106
  output_video = gr.Video()
107
  use_enhancer = gr.Checkbox(
108
- label="face enhance",
109
- info="Whether use face enhance model.")
110
  with gr.Row():
111
  use_sr = gr.Checkbox(
112
- label="super resolution",
113
- info="Whether use image resolution model.")
114
  scale = gr.Number(
115
- value=1, label='image super resolution scale')
116
  with gr.Row():
117
  face_sim_thre = gr.Number(
118
  value=0.6,
119
- label='face similarity threshold',
120
  minimum=0.0,
121
  maximum=1.0)
122
- convert_button = gr.Button('Swap')
123
  convert_button.click(fn=swap_face,
124
  inputs=[
125
  video_input, dst_face_image,
@@ -127,37 +127,37 @@ def main():
127
  use_sr, scale, face_sim_thre
128
  ],
129
  outputs=[output_video],
130
- api_name='video swap')
131
 
132
- with gr.Tab('PoseSwapper'):
133
- gr.Markdown('DoFaker: Pose Swap Web UI')
134
- with gr.Tab('Image'):
135
  with gr.Row():
136
  with gr.Column():
137
- gr.Markdown('The source image to be swapped')
138
- image_input = gr.Image(type='filepath')
139
- gr.Markdown('The target image with pose')
140
- target = gr.Image(type='filepath')
141
 
142
  with gr.Column():
143
- output_image = gr.Image(type='filepath')
144
  use_enhancer = gr.Checkbox(
145
- label="face enhance",
146
- info="Whether use face enhance model.")
147
  with gr.Row():
148
  use_sr = gr.Checkbox(
149
- label="super resolution",
150
- info="Whether use image resolution model.")
151
  scale = gr.Number(
152
- value=1, label='image super resolution scale')
153
- convert_button = gr.Button('Swap')
154
  convert_button.click(fn=swap_pose,
155
  inputs=[
156
  image_input, target,
157
  use_enhancer, use_sr, scale
158
  ],
159
  outputs=[output_image],
160
- api_name='image swap')
161
 
162
  # with gr.Tab('Video'):
163
  # with gr.Row():
 
5
 
6
 
7
  def parse_args():
8
+ parser = argparse.ArgumentParser(description='โณrunning face swap')
9
  parser.add_argument(
10
  '--inbrowser',
11
  help=
 
41
  def main():
42
  args = parse_args()
43
 
44
+ with gr.Blocks(title='FaceClone') as web_ui:
45
+ gr.Markdown('๐ŸงธFaceClone๐Ÿงธ Deepfake Swap Face and Pose')
46
+ with gr.Tab('๐Ÿ’šFaceSwapper'):
47
+ gr.Markdown('๐ŸงธFaceClone๐Ÿงธ power by Gradio')
48
+ with gr.Tab('๐Ÿ“ฅImage'):
49
  with gr.Row():
50
  with gr.Column():
51
+ gr.Markdown('๐Ÿ–‡๏ธThe source image to be swapped')
52
+ image_input = gr.Image(type='๐Ÿ“—filepath')
53
  with gr.Row():
54
  with gr.Column():
55
  gr.Markdown(
56
+ '๐ŸŽญtarget face included in source image')
57
+ dst_face_image = gr.Image(type='๐Ÿ“—filepath')
58
  with gr.Column():
59
  gr.Markdown(
60
+ '๐Ÿง‘โ€๐Ÿฆณsource face to replace target face')
61
+ src_face_image = gr.Image(type='๐Ÿ“—filepath')
62
 
63
  with gr.Column():
64
+ output_image = gr.Image(type='๐Ÿ“—filepath')
65
  use_enhancer = gr.Checkbox(
66
+ label="๐Ÿ‘‘face enhance",
67
+ info="๐ŸงฟWhether use face enhance model.")
68
  with gr.Row():
69
  use_sr = gr.Checkbox(
70
+ label="๐Ÿ› ๏ธsuper resolution",
71
+ info="โš’๏ธWhether use image resolution model.")
72
  scale = gr.Number(
73
+ value=1, label='๐Ÿ“image super resolution scale')
74
  with gr.Row():
75
  face_sim_thre = gr.Number(
76
  value=0.6,
77
+ label='๐Ÿงฒface similarity threshold',
78
  minimum=0.0,
79
  maximum=1.0)
80
+ convert_button = gr.Button('๐Ÿ”Swap')
81
  convert_button.click(fn=swap_face,
82
  inputs=[
83
  image_input, dst_face_image,
 
85
  use_sr, scale, face_sim_thre
86
  ],
87
  outputs=[output_image],
88
+ api_name='๐Ÿ”Žimage swap')
89
 
90
+ with gr.Tab('๐Ÿ–ฅ๏ธVideo'):
91
  with gr.Row():
92
  with gr.Column():
93
+ gr.Markdown('๐ŸŽž๏ธThe source video to be swapped')
94
  video_input = gr.Video()
95
  with gr.Row():
96
  with gr.Column():
97
  gr.Markdown(
98
+ '๐Ÿ“นtarget face included in source image')
99
  dst_face_image = gr.Image(type='filepath')
100
  with gr.Column():
101
  gr.Markdown(
102
+ '๐Ÿง’source face to replace target face')
103
  src_face_image = gr.Image(type='filepath')
104
 
105
  with gr.Column():
106
  output_video = gr.Video()
107
  use_enhancer = gr.Checkbox(
108
+ label="๐Ÿ“ธface enhance",
109
+ info="๐Ÿ“ทWhether use face enhance model.")
110
  with gr.Row():
111
  use_sr = gr.Checkbox(
112
+ label="๐Ÿ”‹super resolution",
113
+ info="๐Ÿ”ฆWhether use image resolution model.")
114
  scale = gr.Number(
115
+ value=1, label='๐Ÿ—ž๏ธimage super resolution scale')
116
  with gr.Row():
117
  face_sim_thre = gr.Number(
118
  value=0.6,
119
+ label='๐Ÿ’Œface similarity threshold',
120
  minimum=0.0,
121
  maximum=1.0)
122
+ convert_button = gr.Button('๐Ÿ”—Swap')
123
  convert_button.click(fn=swap_face,
124
  inputs=[
125
  video_input, dst_face_image,
 
127
  use_sr, scale, face_sim_thre
128
  ],
129
  outputs=[output_video],
130
+ api_name='๐Ÿ“กvideo swap')
131
 
132
+ with gr.Tab('๐Ÿ”ฎPoseSwapper'):
133
+ gr.Markdown('๐ŸงธFaceClone๐Ÿงธ Deepfake power by Gradio')
134
+ with gr.Tab('๐Ÿ“ทImage'):
135
  with gr.Row():
136
  with gr.Column():
137
+ gr.Markdown('๐Ÿง‘โ€๐ŸฆณThe source image to be swapped')
138
+ image_input = gr.Image(type='๐Ÿ“—filepath')
139
+ gr.Markdown('๐Ÿ—ณ๏ธThe target image with pose')
140
+ target = gr.Image(type='๐Ÿ“—filepath')
141
 
142
  with gr.Column():
143
+ output_image = gr.Image(type='๐Ÿ“—filepath')
144
  use_enhancer = gr.Checkbox(
145
+ label="๐Ÿ‘‘face enhance",
146
+ info="๐ŸงพWhether use face enhance model.")
147
  with gr.Row():
148
  use_sr = gr.Checkbox(
149
+ label="๐Ÿ› ๏ธsuper resolution",
150
+ info="โŒ›Whether use image resolution model.")
151
  scale = gr.Number(
152
+ value=1, label='๐Ÿ“ธimage super resolution scale')
153
+ convert_button = gr.Button('๐ŸงฟSwap')
154
  convert_button.click(fn=swap_pose,
155
  inputs=[
156
  image_input, target,
157
  use_enhancer, use_sr, scale
158
  ],
159
  outputs=[output_image],
160
+ api_name='๐ŸŽญimage swap')
161
 
162
  # with gr.Tab('Video'):
163
  # with gr.Row():