Spaces:
Runtime error
Runtime error
Commit
·
0123586
1
Parent(s):
6d1f05f
Update app_multi.py
Browse files- app_multi.py +35 -0
app_multi.py
CHANGED
@@ -8,6 +8,9 @@ import os
|
|
8 |
import time
|
9 |
import random
|
10 |
|
|
|
|
|
|
|
11 |
import matplotlib.pyplot as plt
|
12 |
import numpy as np
|
13 |
from PIL import Image, ImageDraw, ImageFont
|
@@ -38,6 +41,38 @@ from infer_pack.models import (
|
|
38 |
)
|
39 |
from vc_infer_pipeline import VC
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# SadTalker
|
42 |
|
43 |
import os, sys
|
|
|
8 |
import time
|
9 |
import random
|
10 |
|
11 |
+
from search import get_youtube, download_random
|
12 |
+
import soundfile
|
13 |
+
|
14 |
import matplotlib.pyplot as plt
|
15 |
import numpy as np
|
16 |
from PIL import Image, ImageDraw, ImageFont
|
|
|
41 |
)
|
42 |
from vc_infer_pipeline import VC
|
43 |
|
44 |
+
# music search
|
45 |
+
|
46 |
+
def auto_search(name):
|
47 |
+
save_music_path = '/tmp/downloaded'
|
48 |
+
if not os.path.exists(save_music_path):
|
49 |
+
os.makedirs(save_music_path)
|
50 |
+
|
51 |
+
config = {'logfilepath': 'musicdl.log', save_music_path: save_music_path, 'search_size_per_source': 5,
|
52 |
+
'proxies': {}}
|
53 |
+
save_path = os.path.join(save_music_path, name + '.mp3')
|
54 |
+
# youtube
|
55 |
+
get_youtube(name, os.path.join(save_music_path, name))
|
56 |
+
# task1 = threading.Thread(
|
57 |
+
# target=get_youtube,
|
58 |
+
# args=(name, os.path.join(save_music_path, name))
|
59 |
+
# )
|
60 |
+
# task1.start()
|
61 |
+
# task2 = threading.Thread(
|
62 |
+
# target=download_random,
|
63 |
+
# args=(name, config, save_path)
|
64 |
+
# )
|
65 |
+
# task2.start()
|
66 |
+
# task1.join(timeout=20)
|
67 |
+
# task2.join(timeout=10)
|
68 |
+
|
69 |
+
if not os.path.exists(save_path):
|
70 |
+
return "Not Found", None
|
71 |
+
signal, sampling_rate = soundfile.read(save_path, dtype=np.int16)
|
72 |
+
# signal, sampling_rate = open_audio(save_path)
|
73 |
+
|
74 |
+
return (sampling_rate, signal)
|
75 |
+
|
76 |
# SadTalker
|
77 |
|
78 |
import os, sys
|