Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from flask import Flask, request, jsonify, render_template
|
| 2 |
from bs4 import BeautifulSoup
|
|
|
|
| 3 |
import requests
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
|
@@ -8,6 +9,19 @@ app = Flask(__name__)
|
|
| 8 |
def index():
|
| 9 |
return '<h1>OK</h1>'
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
@app.route('/proxy')
|
| 12 |
def proxy():
|
| 13 |
url = request.args.get('url')
|
|
|
|
| 1 |
from flask import Flask, request, jsonify, render_template
|
| 2 |
from bs4 import BeautifulSoup
|
| 3 |
+
from scraper import voicevox
|
| 4 |
import requests
|
| 5 |
|
| 6 |
app = Flask(__name__)
|
|
|
|
| 9 |
def index():
|
| 10 |
return '<h1>OK</h1>'
|
| 11 |
|
| 12 |
+
@app.route("voicevox")
|
| 13 |
+
def voicevox_resp():
|
| 14 |
+
text = request.args.get("text")
|
| 15 |
+
speaker = request.args.get("speaker")
|
| 16 |
+
if not text:
|
| 17 |
+
return jsonify({'error': "Please provided parameter 'text'"}), 400
|
| 18 |
+
|
| 19 |
+
try:
|
| 20 |
+
data = voicevox(text, speaker=speaker)
|
| 21 |
+
return data, 200
|
| 22 |
+
except Exception as e:
|
| 23 |
+
return jsonify({'error': str(e)}), 500
|
| 24 |
+
|
| 25 |
@app.route('/proxy')
|
| 26 |
def proxy():
|
| 27 |
url = request.args.get('url')
|