changes?
Browse files
App/Generate/database/DescriptAPI.py
CHANGED
|
@@ -5,7 +5,7 @@ from collections import deque
|
|
| 5 |
import wave
|
| 6 |
import uuid
|
| 7 |
from pydub import AudioSegment
|
| 8 |
-
|
| 9 |
|
| 10 |
import wave
|
| 11 |
import struct
|
|
@@ -101,7 +101,7 @@ def concatenate_wav_files(input_files, file_directory):
|
|
| 101 |
|
| 102 |
|
| 103 |
class Speak:
|
| 104 |
-
def __init__(self, api_url="https://yakova-embedding.hf.space", dir="
|
| 105 |
self.api_url = api_url
|
| 106 |
self.dir = dir
|
| 107 |
|
|
@@ -143,10 +143,8 @@ class Speak:
|
|
| 143 |
|
| 144 |
async def download_file(self, url):
|
| 145 |
filename = str(uuid.uuid4()) + ".wav"
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
save_path = os.path.join(temp_dir.name, filename)
|
| 149 |
-
print(url)
|
| 150 |
async with aiohttp.ClientSession() as session:
|
| 151 |
async with session.get(url) as response:
|
| 152 |
if response.status == 200:
|
|
|
|
| 5 |
import wave
|
| 6 |
import uuid
|
| 7 |
from pydub import AudioSegment
|
| 8 |
+
|
| 9 |
|
| 10 |
import wave
|
| 11 |
import struct
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
class Speak:
|
| 104 |
+
def __init__(self, api_url="https://yakova-embedding.hf.space", dir="./tmp"):
|
| 105 |
self.api_url = api_url
|
| 106 |
self.dir = dir
|
| 107 |
|
|
|
|
| 143 |
|
| 144 |
async def download_file(self, url):
|
| 145 |
filename = str(uuid.uuid4()) + ".wav"
|
| 146 |
+
os.makedirs(self.dir, exist_ok=True)
|
| 147 |
+
save_path = os.path.join(self.dir, filename)
|
|
|
|
|
|
|
| 148 |
async with aiohttp.ClientSession() as session:
|
| 149 |
async with session.get(url) as response:
|
| 150 |
if response.status == 200:
|