pengdaqian commited on
Commit
9c5a76d
·
1 Parent(s): 4cfe760
Files changed (1) hide show
  1. app.py +87 -83
app.py CHANGED
@@ -266,87 +266,91 @@ def auto_search(name):
266
  return "Found a music", (sampling_rate, signal)
267
 
268
 
269
- app = gr.Blocks()
270
-
271
-
272
- def on_close():
273
- sys.exit(0)
274
-
275
-
276
- with app:
277
- title = "Singer Voice Clone 0.1 Demo"
278
- desc = """ small singer voice clone Demo App. <br />
279
- Enter keywords auto search music to clone or upload music yourself <br />
280
- It's just a simplified demo, you can use more advanced features optimize music quality <br />"""
281
- tutorial_link = "https://docs.cworld.ai"
282
-
283
- gr.HTML(
284
- f"""
285
- <div style="text-align: center; margin: 0 auto;">
286
- <a href="https://cworld.ai">
287
- <svg style="margin: 0 auto;" width="155" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 407 100">
288
- <g id="SvgjsG2746"
289
- transform="matrix(0.8454106280193237,0,0,0.8454106280193237,-4.2270531400966185,-4.2270531400966185)"
290
- fill="#111">
291
- <g xmlns="http://www.w3.org/2000/svg">
292
- <g>
293
- <g>
294
- <path d="M50,11c21.5,0,39,17.5,39,39S71.5,89,50,89S11,71.5,11,50S28.5,11,50,11 M50,5C25.1,5,5,25.1,5,50s20.1,45,45,45 s45-20.1,45-45S74.9,5,50,5L50,5z"></path>
 
 
295
  </g>
296
- </g>
297
- <path d="M55,75H45v-5c0-2.8,2.2-5,5-5h0c2.8,0,5,2.2,5,5V75z"></path>
298
- <rect x="25" y="35" width="10" height="20"></rect>
299
- <rect x="65" y="35" width="10" height="20"></rect>
300
- </g>
301
- </g>
302
- <g id="SvgjsG2747"
303
- transform="matrix(3.3650250410766605,0,0,3.3650250410766605,93.98098208712985,-3.546415304677616)"
304
- fill="#111">
305
- <path
306
- d="M8.1 17.42 l1.42 1.28 c-0.94 1.04 -2.28 1.5 -3.78 1.5 c-2.84 0 -5.14 -2.18 -5.14 -5.12 s2.3 -5.14 5.14 -5.14 c1.5 0 2.84 0.46 3.78 1.5 l-1.42 1.28 c-0.58 -0.78 -1.42 -1.08 -2.36 -1.08 c-1.7 0 -3.08 1.42 -3.08 3.44 c0 2 1.38 3.44 3.08 3.44 c0.94 0 1.78 -0.3 2.36 -1.1 z M23.42 10.12 l2.06 0 l-3.76 9.88 l-1.26 0 l-2.46 -6.4 l-2.44 6.4 l-1.26 0 l-3.78 -9.88 l2.08 0 l2.34 6.9 l2.06 -6.08 l0.26 -0.82 l1.48 0 l0.28 0.82 l2.06 6.08 z M31.62 11.64 c-1.7 0 -3.08 1.42 -3.08 3.44 c0 2 1.38 3.44 3.08 3.44 s3.08 -1.44 3.08 -3.44 c0 -2.02 -1.38 -3.44 -3.08 -3.44 z M31.62 9.94 c2.84 0 5.14 2.2 5.14 5.14 s-2.3 5.12 -5.14 5.12 s-5.14 -2.18 -5.14 -5.12 s2.3 -5.14 5.14 -5.14 z M44.9 10.24 l-0.44 1.62 c-0.14 -0.08 -0.58 -0.22 -0.94 -0.22 c-1.7 0 -2.5 1.62 -2.5 3.62 l0 4.74 l-2.06 0 l0 -9.88 l2.06 0 l0 1.4 c0.24 -0.92 1.3 -1.58 2.48 -1.58 c0.54 0 1.12 0.14 1.4 0.3 z M48.379999999999995 4.619999999999999 l0 15.38 l-2.08 0 l0 -15.38 l2.08 0 z M50.98 15.08 c0 -2.94 2.1 -5.14 4.94 -5.14 c0.98 0 2.18 0.42 2.84 0.96 l0 -5.9 l2.08 0 l0 15 l-2.08 0 l0 -0.74 c-0.78 0.58 -1.86 0.94 -2.84 0.94 c-2.84 0 -4.94 -2.18 -4.94 -5.12 z M53.06 15.08 c0 2 1.38 3.44 3.06 3.44 c1.12 0 2.12 -0.52 2.64 -1.58 c0.28 -0.54 0.44 -1.18 0.44 -1.86 s-0.16 -1.32 -0.44 -1.88 c-0.52 -1.06 -1.52 -1.56 -2.64 -1.56 c-1.68 0 -3.06 1.42 -3.06 3.44 z M66.46 18.78 c0 0.8 -0.62 1.42 -1.42 1.42 c-0.78 0 -1.4 -0.62 -1.4 -1.42 c0 -0.76 0.62 -1.38 1.4 -1.38 c0.8 0 1.42 0.62 1.42 1.38 z M73.08 9.92 c2.84 0 3.98 1.72 3.98 3.18 l0 6.9 l-2.06 0 l0 -1.08 c-0.72 0.98 -2 1.26 -2.8 1.26 c-2.26 0 -3.74 -1.32 -3.74 -3.08 c0 -2.46 1.84 -3.34 3.74 -3.34 l2.8 0 l0 -0.66 c0 -0.62 -0.24 -1.48 -1.92 -1.48 c-0.94 0 -1.8 0.5 -2.36 1.28 l-1.42 -1.28 c0.94 -1.04 2.28 -1.7 3.78 -1.7 z M75 16.92 l0 -1.48 l-2.52 0 c-1.22 0 -2.08 0.62 -1.94 1.74 c0.12 0.94 0.88 1.32 1.94 1.32 c1.9 0 2.52 -0.9 2.52 -1.58 z M81.9 10.12 l0 9.88 l-2.06 0 l0 -9.88 l2.06 0 z M82 6.5 c0 0.64 -0.5 1.14 -1.14 1.14 c-0.62 0 -1.12 -0.5 -1.12 -1.14 c0 -0.62 0.5 -1.12 1.12 -1.12 c0.64 0 1.14 0.5 1.14 1.12 z"></path>
307
- </g>
308
- </svg>
309
- </a>
310
- <div
311
- style="
312
- display: inline-flex;
313
- align-items: center;
314
- gap: 0.8rem;
315
- font-size: 1.75rem;
316
- "
317
- >
318
- <h1 style="font-weight: 900; margin-bottom: 7px;margin-top:5px">
319
- {title}
320
- </h1>
321
- </div>
322
- <p style="margin-bottom: 10px; font-size: 94%; line-height: 23px;">
323
- {desc}
324
- There is the <a href="{tutorial_link}"> tutorial </a>
325
- </p>
326
- </div>
327
- """
328
- )
329
-
330
- with gr.Group():
331
- with gr.Box():
332
- with gr.Row():
333
- with gr.Column():
334
- sid = gr.Dropdown(label="Singer", choices=["22", "33", "47", "51"], value="47")
335
-
336
- vc_input2 = gr.Textbox(label="Music Name")
337
- vc_search = gr.Button("Auto Search", variant="primary")
338
-
339
- with gr.Column():
340
- vc_input3 = gr.Audio(label="Upload Music Yourself")
341
- vc_submit = gr.Button("Convert", variant="primary")
342
-
343
- with gr.Column():
344
- vc_output1 = gr.Textbox(label="Run Status")
345
- vc_output2 = gr.Audio(label="Result Audio")
346
-
347
- vc_search.click(auto_search, [vc_input2], [vc_output1, vc_input3])
348
- vc_submit.click(svc_main, [sid, vc_input3], [vc_output1, vc_output2])
349
-
350
- app.set_on_close(on_close)
351
-
352
- app.queue(max_size=3, api_open=False).launch()
 
 
 
266
  return "Found a music", (sampling_rate, signal)
267
 
268
 
269
+ def main():
270
+ app = gr.Blocks()
271
+
272
+ try:
273
+ with app:
274
+ title = "Singer Voice Clone 0.1 Demo"
275
+ desc = """ small singer voice clone Demo App. <br />
276
+ Enter keywords auto search music to clone or upload music yourself <br />
277
+ It's just a simplified demo, you can use more advanced features optimize music quality <br />"""
278
+ tutorial_link = "https://docs.cworld.ai"
279
+
280
+ gr.HTML(
281
+ f"""
282
+ <div style="text-align: center; margin: 0 auto;">
283
+ <a href="https://cworld.ai">
284
+ <svg style="margin: 0 auto;" width="155" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 407 100">
285
+ <g id="SvgjsG2746"
286
+ transform="matrix(0.8454106280193237,0,0,0.8454106280193237,-4.2270531400966185,-4.2270531400966185)"
287
+ fill="#111">
288
+ <g xmlns="http://www.w3.org/2000/svg">
289
+ <g>
290
+ <g>
291
+ <path d="M50,11c21.5,0,39,17.5,39,39S71.5,89,50,89S11,71.5,11,50S28.5,11,50,11 M50,5C25.1,5,5,25.1,5,50s20.1,45,45,45 s45-20.1,45-45S74.9,5,50,5L50,5z"></path>
292
+ </g>
293
+ </g>
294
+ <path d="M55,75H45v-5c0-2.8,2.2-5,5-5h0c2.8,0,5,2.2,5,5V75z"></path>
295
+ <rect x="25" y="35" width="10" height="20"></rect>
296
+ <rect x="65" y="35" width="10" height="20"></rect>
297
  </g>
298
+ </g>
299
+ <g id="SvgjsG2747"
300
+ transform="matrix(3.3650250410766605,0,0,3.3650250410766605,93.98098208712985,-3.546415304677616)"
301
+ fill="#111">
302
+ <path
303
+ d="M8.1 17.42 l1.42 1.28 c-0.94 1.04 -2.28 1.5 -3.78 1.5 c-2.84 0 -5.14 -2.18 -5.14 -5.12 s2.3 -5.14 5.14 -5.14 c1.5 0 2.84 0.46 3.78 1.5 l-1.42 1.28 c-0.58 -0.78 -1.42 -1.08 -2.36 -1.08 c-1.7 0 -3.08 1.42 -3.08 3.44 c0 2 1.38 3.44 3.08 3.44 c0.94 0 1.78 -0.3 2.36 -1.1 z M23.42 10.12 l2.06 0 l-3.76 9.88 l-1.26 0 l-2.46 -6.4 l-2.44 6.4 l-1.26 0 l-3.78 -9.88 l2.08 0 l2.34 6.9 l2.06 -6.08 l0.26 -0.82 l1.48 0 l0.28 0.82 l2.06 6.08 z M31.62 11.64 c-1.7 0 -3.08 1.42 -3.08 3.44 c0 2 1.38 3.44 3.08 3.44 s3.08 -1.44 3.08 -3.44 c0 -2.02 -1.38 -3.44 -3.08 -3.44 z M31.62 9.94 c2.84 0 5.14 2.2 5.14 5.14 s-2.3 5.12 -5.14 5.12 s-5.14 -2.18 -5.14 -5.12 s2.3 -5.14 5.14 -5.14 z M44.9 10.24 l-0.44 1.62 c-0.14 -0.08 -0.58 -0.22 -0.94 -0.22 c-1.7 0 -2.5 1.62 -2.5 3.62 l0 4.74 l-2.06 0 l0 -9.88 l2.06 0 l0 1.4 c0.24 -0.92 1.3 -1.58 2.48 -1.58 c0.54 0 1.12 0.14 1.4 0.3 z M48.379999999999995 4.619999999999999 l0 15.38 l-2.08 0 l0 -15.38 l2.08 0 z M50.98 15.08 c0 -2.94 2.1 -5.14 4.94 -5.14 c0.98 0 2.18 0.42 2.84 0.96 l0 -5.9 l2.08 0 l0 15 l-2.08 0 l0 -0.74 c-0.78 0.58 -1.86 0.94 -2.84 0.94 c-2.84 0 -4.94 -2.18 -4.94 -5.12 z M53.06 15.08 c0 2 1.38 3.44 3.06 3.44 c1.12 0 2.12 -0.52 2.64 -1.58 c0.28 -0.54 0.44 -1.18 0.44 -1.86 s-0.16 -1.32 -0.44 -1.88 c-0.52 -1.06 -1.52 -1.56 -2.64 -1.56 c-1.68 0 -3.06 1.42 -3.06 3.44 z M66.46 18.78 c0 0.8 -0.62 1.42 -1.42 1.42 c-0.78 0 -1.4 -0.62 -1.4 -1.42 c0 -0.76 0.62 -1.38 1.4 -1.38 c0.8 0 1.42 0.62 1.42 1.38 z M73.08 9.92 c2.84 0 3.98 1.72 3.98 3.18 l0 6.9 l-2.06 0 l0 -1.08 c-0.72 0.98 -2 1.26 -2.8 1.26 c-2.26 0 -3.74 -1.32 -3.74 -3.08 c0 -2.46 1.84 -3.34 3.74 -3.34 l2.8 0 l0 -0.66 c0 -0.62 -0.24 -1.48 -1.92 -1.48 c-0.94 0 -1.8 0.5 -2.36 1.28 l-1.42 -1.28 c0.94 -1.04 2.28 -1.7 3.78 -1.7 z M75 16.92 l0 -1.48 l-2.52 0 c-1.22 0 -2.08 0.62 -1.94 1.74 c0.12 0.94 0.88 1.32 1.94 1.32 c1.9 0 2.52 -0.9 2.52 -1.58 z M81.9 10.12 l0 9.88 l-2.06 0 l0 -9.88 l2.06 0 z M82 6.5 c0 0.64 -0.5 1.14 -1.14 1.14 c-0.62 0 -1.12 -0.5 -1.12 -1.14 c0 -0.62 0.5 -1.12 1.12 -1.12 c0.64 0 1.14 0.5 1.14 1.12 z"></path>
304
+ </g>
305
+ </svg>
306
+ </a>
307
+ <div
308
+ style="
309
+ display: inline-flex;
310
+ align-items: center;
311
+ gap: 0.8rem;
312
+ font-size: 1.75rem;
313
+ "
314
+ >
315
+ <h1 style="font-weight: 900; margin-bottom: 7px;margin-top:5px">
316
+ {title}
317
+ </h1>
318
+ </div>
319
+ <p style="margin-bottom: 10px; font-size: 94%; line-height: 23px;">
320
+ {desc}
321
+ There is the <a href="{tutorial_link}"> tutorial </a>
322
+ </p>
323
+ </div>
324
+ """
325
+ )
326
+
327
+ with gr.Group():
328
+ with gr.Box():
329
+ with gr.Row():
330
+ with gr.Column():
331
+ sid = gr.Dropdown(label="Singer", choices=["22", "33", "47", "51"], value="47")
332
+
333
+ vc_input2 = gr.Textbox(label="Music Name")
334
+ vc_search = gr.Button("Auto Search", variant="primary")
335
+
336
+ with gr.Column():
337
+ vc_input3 = gr.Audio(label="Upload Music Yourself")
338
+ vc_submit = gr.Button("Convert", variant="primary")
339
+
340
+ with gr.Column():
341
+ vc_output1 = gr.Textbox(label="Run Status")
342
+ vc_output2 = gr.Audio(label="Result Audio")
343
+
344
+ vc_search.click(auto_search, [vc_input2], [vc_output1, vc_input3])
345
+ vc_submit.click(svc_main, [sid, vc_input3], [vc_output1, vc_output2])
346
+
347
+ app.set_on_close(on_close)
348
+
349
+ app.queue(max_size=3, api_open=False).launch()
350
+ except KeyboardInterrupt:
351
+ app.close()
352
+ sys.exit(0)
353
+
354
+
355
+ if __name__ == '__main__':
356
+ main()