from flask import Flask, Response, request, url_for
from plivo import plivoxml
app = Flask(__name__)
@app.route("/ssml/", methods=["GET", "POST"])
def ssml():
element = plivoxml.ResponseElement()
response = (
element.add(
plivoxml.SpeakElement(content="The word", voice="Polly.Joey", language="en-US")
.add_say_as("read", interpret_as="characters")
.add_s("may be interpreted as either the present simple form")
.add_w("read", role="amazon:VB")
.add_s("or the past participle form")
.add_w("read", role="amazon:VBD")
)
.to_string(False)
)
print(response)
return Response(response, mimetype="text/xml")
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)