fffiloni commited on
Commit
177aa06
1 Parent(s): a420442

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -66
app.py CHANGED
@@ -53,68 +53,82 @@ with gr.Blocks() as demo:
53
  with gr.Column():
54
  gr.Markdown("# Expression Editor")
55
  gr.Markdown("Demo for expression-editor cog image by fofr")
 
 
 
 
 
 
 
56
  with gr.Row():
57
  with gr.Column():
58
  image = gr.Image(
59
  label="Image",
60
  type="filepath"
61
  )
 
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  with gr.Row():
64
- rotate_pitch = gr.Slider(
65
- label="Rotate Pitch", info='''Rotation pitch: Adjusts the up and down tilt of the face''',
66
- value=0,
67
- minimum=-20, maximum=20
68
- )
69
- rotate_yaw = gr.Slider(
70
- label="Rotate Yaw", info='''Rotation yaw: Adjusts the left and right turn of the face''',
71
- value=0,
72
- minimum=-20, maximum=20
73
- )
74
- rotate_roll = gr.Slider(
75
- label="Rotate Roll", info='''Rotation roll: Adjusts the tilt of the face to the left or right''', value=0,
76
- minimum=-20, maximum=20
77
- )
78
- with gr.Row():
79
- blink = gr.Slider(
80
- label="Blink", info='''Blink: Controls the degree of eye closure''', value=0,
81
- minimum=-20, maximum=5
82
- )
83
- eyebrow = gr.Slider(
84
- label="Eyebrow", info='''Eyebrow: Adjusts the height and shape of the eyebrows''', value=0,
85
- minimum=-10, maximum=15
86
- )
87
- wink = gr.Slider(
88
- label="Wink", info='''Wink: Controls the degree of one eye closing''', value=0,
89
- minimum=0, maximum=25
90
- )
91
- with gr.Row():
92
- pupil_x = gr.Slider(
93
- label="Pupil X", info='''Pupil X: Adjusts the horizontal position of the pupils''', value=0,
94
- minimum=-15, maximum=15
95
- )
96
- pupil_y = gr.Slider(
97
- label="Pupil Y", info='''Pupil Y: Adjusts the vertical position of the pupils''', value=0,
98
- minimum=-15, maximum=15
99
- )
100
- with gr.Row():
101
- aaa = gr.Slider(
102
- label="Aaa", info='''AAA: Controls the mouth opening for 'aaa' sound''', value=0,
103
- minimum=-30, maximum=120
104
- )
105
- eee = gr.Slider(
106
- label="Eee", info='''EEE: Controls the mouth shape for 'eee' sound''', value=0,
107
- minimum=-20, maximum=15
108
- )
109
- woo = gr.Slider(
110
- label="Woo", info='''WOO: Controls the mouth shape for 'woo' sound''', value=0,
111
- minimum=-20, maximum=15
112
- )
113
- smile = gr.Slider(
114
- label="Smile", info='''Smile: Adjusts the degree of smiling''', value=0,
115
- minimum=-0.3, maximum=1.3
116
- )
117
- with gr.Accordion("More Settings", open=False):
118
  src_ratio = gr.Number(
119
  label="Src Ratio", info='''Source ratio''', value=1
120
  )
@@ -126,24 +140,14 @@ with gr.Blocks() as demo:
126
  label="Crop Factor", info='''Crop factor''', value=1.7,
127
  minimum=1.5, maximum=2.5
128
  )
 
129
  output_format = gr.Dropdown(
130
  choices=['webp', 'jpg', 'png'], label="output_format", info='''Format of the output images''', value="webp"
131
  )
132
  output_quality = gr.Number(
133
  label="Output Quality", info='''Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.''', value=95
134
  )
135
- submit_btn = gr.Button("Submit")
136
- with gr.Column():
137
- result_image = gr.Image()
138
- gr.HTML("""
139
- <div style="display: flex; justify-content: center; align-items: center; text-align: center;">
140
- <p style="display: flex;gap: 6px;">
141
- <a href="https://huggingface.co/spaces/fffiloni/expression-editor?duplicate=true">
142
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-md.svg" alt="Duplicate this Space">
143
- </a> to skip the queue and enjoy faster inference on the GPU of your choice
144
- </p>
145
- </div>
146
- """)
147
 
148
  inputs = [image, rotate_pitch, rotate_yaw, rotate_roll, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile, src_ratio, sample_ratio, crop_factor, output_format, output_quality]
149
  outputs = [result_image]
 
53
  with gr.Column():
54
  gr.Markdown("# Expression Editor")
55
  gr.Markdown("Demo for expression-editor cog image by fofr")
56
+ gr.HTML("""
57
+ <p style="display: flex;gap: 6px;">
58
+ <a href="https://huggingface.co/spaces/fffiloni/expression-editor?duplicate=true">
59
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-md.svg" alt="Duplicate this Space">
60
+ </a> to skip the queue and enjoy faster inference on the GPU of your choice
61
+ </p>
62
+ """)
63
  with gr.Row():
64
  with gr.Column():
65
  image = gr.Image(
66
  label="Image",
67
  type="filepath"
68
  )
69
+ with gr.Column():
70
+ result_image = gr.Image()
71
 
72
+ submit_btn = gr.Button("Submit")
73
+
74
+ with gr.Row():
75
+ rotate_pitch = gr.Slider(
76
+ label="Rotate Pitch", info='''Rotation pitch: Adjusts the up and down tilt of the face''',
77
+ value=0,
78
+ minimum=-20, maximum=20
79
+ )
80
+ rotate_yaw = gr.Slider(
81
+ label="Rotate Yaw", info='''Rotation yaw: Adjusts the left and right turn of the face''',
82
+ value=0,
83
+ minimum=-20, maximum=20
84
+ )
85
+ rotate_roll = gr.Slider(
86
+ label="Rotate Roll", info='''Rotation roll: Adjusts the tilt of the face to the left or right''', value=0,
87
+ minimum=-20, maximum=20
88
+ )
89
+ with gr.Row():
90
+
91
+ blink = gr.Slider(
92
+ label="Blink", info='''Blink: Controls the degree of eye closure''', value=0,
93
+ minimum=-20, maximum=5
94
+ )
95
+ eyebrow = gr.Slider(
96
+ label="Eyebrow", info='''Eyebrow: Adjusts the height and shape of the eyebrows''', value=0,
97
+ minimum=-10, maximum=15
98
+ )
99
+ wink = gr.Slider(
100
+ label="Wink", info='''Wink: Controls the degree of one eye closing''', value=0,
101
+ minimum=0, maximum=25
102
+ )
103
+
104
+ pupil_x = gr.Slider(
105
+ label="Pupil X", info='''Pupil X: Adjusts the horizontal position of the pupils''', value=0,
106
+ minimum=-15, maximum=15
107
+ )
108
+ pupil_y = gr.Slider(
109
+ label="Pupil Y", info='''Pupil Y: Adjusts the vertical position of the pupils''', value=0,
110
+ minimum=-15, maximum=15
111
+ )
112
+ with gr.Row():
113
+ aaa = gr.Slider(
114
+ label="Aaa", info='''AAA: Controls the mouth opening for 'aaa' sound''', value=0,
115
+ minimum=-30, maximum=120
116
+ )
117
+ eee = gr.Slider(
118
+ label="Eee", info='''EEE: Controls the mouth shape for 'eee' sound''', value=0,
119
+ minimum=-20, maximum=15
120
+ )
121
+ woo = gr.Slider(
122
+ label="Woo", info='''WOO: Controls the mouth shape for 'woo' sound''', value=0,
123
+ minimum=-20, maximum=15
124
+ )
125
+ smile = gr.Slider(
126
+ label="Smile", info='''Smile: Adjusts the degree of smiling''', value=0,
127
+ minimum=-0.3, maximum=1.3
128
+ )
129
+ with gr.Accordion("More Settings", open=False):
130
+ with gr.column():
131
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  src_ratio = gr.Number(
133
  label="Src Ratio", info='''Source ratio''', value=1
134
  )
 
140
  label="Crop Factor", info='''Crop factor''', value=1.7,
141
  minimum=1.5, maximum=2.5
142
  )
143
+ with gr.Row():
144
  output_format = gr.Dropdown(
145
  choices=['webp', 'jpg', 'png'], label="output_format", info='''Format of the output images''', value="webp"
146
  )
147
  output_quality = gr.Number(
148
  label="Output Quality", info='''Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.''', value=95
149
  )
150
+
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  inputs = [image, rotate_pitch, rotate_yaw, rotate_roll, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile, src_ratio, sample_ratio, crop_factor, output_format, output_quality]
153
  outputs = [result_image]