An app that allows kids to scan the book's and read the book.
from elevenlabs import generate, play
audio = generate(text, voice="DPsqCHWEBVTyO9962K8u")
play(audio)
-
Download the appropriate version for Windows (Go to the FFmpeg Download Page).
-
Extract the files to a directory (e.g., C:\ffmpeg). And add ffmpeg to the System Path.
-
Verify Installation:
ffmpeg --version
-
Open the file
pydub\utils.py
in the pydub package directory. -
Add line " f.close() # close the file stream" in the _play_with_ffplay function.
def _play_with_ffplay(seg): PLAYER = get_player_name() with NamedTemporaryFile("w+b", suffix=".wav") as f: f.close() # close the file stream seg.export(f.name, "wav") subprocess.call([PLAYER, "-nodisp", "-autoexit", "-hide_banner", f.name])
- 确保安装了Python(版本3.5及以上)。
- 安装Briefcase和Toga:
pip install briefcase toga
使用Briefcase创建Toga应用:
briefcase new
编辑src/<app_name>/app.py,开发应用逻辑和UI。示例代码:
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, CENTER
def on_button_press(widget):
print("Hello world!")
def build(app):
button = toga.Button(
'Press me!',
on_press=on_button_press,
style=Pack(padding=20)
)
return toga.Box(
children=[button],
style=Pack(direction=COLUMN, alignment=CENTER, flex=1)
)
def main():
return toga.App(
'First Toga App',
'org.beeware.helloworld',
startup=build
)
if __name__ == '__main__':
main().main_loop()
在应用目录下运行应用进行测试:
briefcase dev