github / github/platform-samples

ai

未关闭
#806 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Shell
星标
2.2k
派生
1.9k
平均合并
7 天 19 小时
30 天内合并 PR
1

描述

from flask import Flask, render_template_string, request, send_file
import pyttsx3
import os
import uuid
import webbrowser
import threading

app = Flask(__name__)

HTML_FORM = """

Voice Service

🎤 Voice Service






Convert to Voice

"""

@app.route('/')
def home():
return render_template_string(HTML_FORM)

@app.route('/speak', methods=['POST'])
def speak():
text = request.form['text']
username = request.form['username']

engine = pyttsx3.init()
filename = f"{uuid.uuid4()}.mp3"
engine.save_to_file(f"{username} says: {text}", filename)
engine.runAndWait()

return send_file(filename, as_attachment=True)

def open_browser():
webbrowser.get("chrome").open("http://127.0.0.1:5000")

if __name__ == '__main__':
threading.Timer(1.5, open_browser).start()
app.run(debug=True)

贡献指南

打开贡献指南

调研方向

The body contains an inline Flask application with the home and /speak routes, but names no repository file, test, or requested change. First clarify whether this code is intended as a new platform sample and what repository entry point should contain it; done should include an agreed sample scope and validation steps.

由索引模型根据 Issue 内容生成。

评估

技术栈
flask, python
领域
backend, web-dev
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
15/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。