Spaces:
Running
Running
Update zh.py
Browse files
zh.py
CHANGED
|
@@ -93,7 +93,7 @@ async def main():
|
|
| 93 |
video.width = reader.streams.video[0].width
|
| 94 |
video.height = reader.streams.video[0].height
|
| 95 |
video.pix_fmt = 'yuv420p'
|
| 96 |
-
with av.open(io.BytesIO(await sys.modules['__main__'].tts(scripts[0]))) as container:
|
| 97 |
audio = writer.add_stream('aac', rate=container.streams.audio[0].rate)
|
| 98 |
speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
|
| 99 |
print(speed)
|
|
@@ -147,7 +147,7 @@ async def main():
|
|
| 147 |
case 200:
|
| 148 |
with zipfile.ZipFile(io.BytesIO(await get.content.read())) as archive:
|
| 149 |
with av.open(io.BytesIO(archive.read('output.mp4'))) as reader:
|
| 150 |
-
with av.open(io.BytesIO(await sys.modules['__main__'].tts(script))) as container:
|
| 151 |
speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
|
| 152 |
print(speed)
|
| 153 |
graph = av.filter.Graph()
|
|
@@ -184,6 +184,7 @@ async def main():
|
|
| 184 |
writer.mux(video.encode())
|
| 185 |
writer.mux(audio.encode())
|
| 186 |
break
|
|
|
|
| 187 |
await asyncio.sleep(math.inf)
|
| 188 |
|
| 189 |
uvloop.run(main())
|
|
|
|
| 93 |
video.width = reader.streams.video[0].width
|
| 94 |
video.height = reader.streams.video[0].height
|
| 95 |
video.pix_fmt = 'yuv420p'
|
| 96 |
+
with av.open(io.BytesIO(await sys.modules['__main__'].tts(scripts[0])), format='mp3') as container:
|
| 97 |
audio = writer.add_stream('aac', rate=container.streams.audio[0].rate)
|
| 98 |
speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
|
| 99 |
print(speed)
|
|
|
|
| 147 |
case 200:
|
| 148 |
with zipfile.ZipFile(io.BytesIO(await get.content.read())) as archive:
|
| 149 |
with av.open(io.BytesIO(archive.read('output.mp4'))) as reader:
|
| 150 |
+
with av.open(io.BytesIO(await sys.modules['__main__'].tts(script)), format='mp3') as container:
|
| 151 |
speed = builtins.float(container.streams.audio[0].duration * container.streams.audio[0].time_base) / 10
|
| 152 |
print(speed)
|
| 153 |
graph = av.filter.Graph()
|
|
|
|
| 184 |
writer.mux(video.encode())
|
| 185 |
writer.mux(audio.encode())
|
| 186 |
break
|
| 187 |
+
huggingface_hub.upload_file(path_or_fileobj='output.mp4', path_in_repo='zh.mp4', repo_id='chaowenguo/wan', repo_type='dataset', token=os.getenv('huggingface'))
|
| 188 |
await asyncio.sleep(math.inf)
|
| 189 |
|
| 190 |
uvloop.run(main())
|