Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import os
|
|
6 |
|
7 |
from utils.gradio_helpers import parse_outputs, process_outputs
|
8 |
|
|
|
9 |
|
10 |
def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
11 |
headers = {'Content-Type': 'application/json'}
|
@@ -46,83 +47,89 @@ def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
|
46 |
raise gr.Error(f"Sorry, the Cog image is still processing. Try again in a bit.")
|
47 |
raise gr.Error(f"The submission failed! Error: {response.status_code}")
|
48 |
|
49 |
-
|
50 |
-
model_description = "None"
|
51 |
|
52 |
with gr.Blocks() as demo:
|
53 |
with gr.Column():
|
|
|
|
|
54 |
with gr.Row():
|
55 |
with gr.Column():
|
56 |
image = gr.Image(
|
57 |
label="Image",
|
58 |
type="filepath"
|
59 |
)
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
)
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
105 |
smile = gr.Slider(
|
106 |
label="Smile", info='''Smile: Adjusts the degree of smiling''', value=0,
|
107 |
minimum=-0.3, maximum=1.3
|
108 |
)
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
126 |
submit_btn = gr.Button("Submit")
|
127 |
with gr.Column():
|
128 |
result_image = gr.Image()
|
|
|
6 |
|
7 |
from utils.gradio_helpers import parse_outputs, process_outputs
|
8 |
|
9 |
+
names = ['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']
|
10 |
|
11 |
def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
12 |
headers = {'Content-Type': 'application/json'}
|
|
|
47 |
raise gr.Error(f"Sorry, the Cog image is still processing. Try again in a bit.")
|
48 |
raise gr.Error(f"The submission failed! Error: {response.status_code}")
|
49 |
|
50 |
+
|
|
|
51 |
|
52 |
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 |
+
with gr.Row():
|
63 |
+
rotate_pitch = gr.Slider(
|
64 |
+
label="Rotate Pitch", info='''Rotation pitch: Adjusts the up and down tilt of the face''',
|
65 |
+
value=0,
|
66 |
+
minimum=-20, maximum=20
|
67 |
+
)
|
68 |
+
rotate_yaw = gr.Slider(
|
69 |
+
label="Rotate Yaw", info='''Rotation yaw: Adjusts the left and right turn of the face''',
|
70 |
+
value=0,
|
71 |
+
minimum=-20, maximum=20
|
72 |
+
)
|
73 |
+
rotate_roll = gr.Slider(
|
74 |
+
label="Rotate Roll", info='''Rotation roll: Adjusts the tilt of the face to the left or right''', value=0,
|
75 |
+
minimum=-20, maximum=20
|
76 |
+
)
|
77 |
+
with gr.Row():
|
78 |
+
blink = gr.Slider(
|
79 |
+
label="Blink", info='''Blink: Controls the degree of eye closure''', value=0,
|
80 |
+
minimum=-20, maximum=5
|
81 |
+
)
|
82 |
+
eyebrow = gr.Slider(
|
83 |
+
label="Eyebrow", info='''Eyebrow: Adjusts the height and shape of the eyebrows''', value=0,
|
84 |
+
minimum=-10, maximum=15
|
85 |
+
)
|
86 |
+
wink = gr.Number(
|
87 |
+
label="Wink", info='''Wink: Controls the degree of one eye closing''', value=0
|
88 |
+
)
|
89 |
+
with gr.Row():
|
90 |
+
pupil_x = gr.Slider(
|
91 |
+
label="Pupil X", info='''Pupil X: Adjusts the horizontal position of the pupils''', value=0,
|
92 |
+
minimum=-15, maximum=15
|
93 |
+
)
|
94 |
+
pupil_y = gr.Slider(
|
95 |
+
label="Pupil Y", info='''Pupil Y: Adjusts the vertical position of the pupils''', value=0,
|
96 |
+
minimum=-15, maximum=15
|
97 |
+
)
|
98 |
+
with gr.Row():
|
99 |
+
aaa = gr.Slider(
|
100 |
+
label="Aaa", info='''AAA: Controls the mouth opening for 'aaa' sound''', value=0,
|
101 |
+
minimum=-30, maximum=120
|
102 |
+
)
|
103 |
+
eee = gr.Slider(
|
104 |
+
label="Eee", info='''EEE: Controls the mouth shape for 'eee' sound''', value=0,
|
105 |
+
minimum=-20, maximum=15
|
106 |
+
)
|
107 |
+
woo = gr.Slider(
|
108 |
+
label="Woo", info='''WOO: Controls the mouth shape for 'woo' sound''', value=0,
|
109 |
+
minimum=-20, maximum=15
|
110 |
+
)
|
111 |
smile = gr.Slider(
|
112 |
label="Smile", info='''Smile: Adjusts the degree of smiling''', value=0,
|
113 |
minimum=-0.3, maximum=1.3
|
114 |
)
|
115 |
+
with gr.Accordion("More Settings", open=False):
|
116 |
+
src_ratio = gr.Number(
|
117 |
+
label="Src Ratio", info='''Source ratio''', value=1
|
118 |
+
)
|
119 |
+
sample_ratio = gr.Slider(
|
120 |
+
label="Sample Ratio", info='''Sample ratio''', value=1,
|
121 |
+
minimum=-0.2, maximum=1.2
|
122 |
+
)
|
123 |
+
crop_factor = gr.Slider(
|
124 |
+
label="Crop Factor", info='''Crop factor''', value=1.7,
|
125 |
+
minimum=1.5, maximum=2.5
|
126 |
+
)
|
127 |
+
output_format = gr.Dropdown(
|
128 |
+
choices=['webp', 'jpg', 'png'], label="output_format", info='''Format of the output images''', value="webp"
|
129 |
+
)
|
130 |
+
output_quality = gr.Number(
|
131 |
+
label="Output Quality", info='''Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.''', value=95
|
132 |
+
)
|
133 |
submit_btn = gr.Button("Submit")
|
134 |
with gr.Column():
|
135 |
result_image = gr.Image()
|