PR test
-
-
Save NilsIrl/bc036be93f22696f9376572e2f096cbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
main.py | |
That's it this is the entire API. | |
""" | |
from flask import Flask, jsonify | |
import markovify | |
app = Flask(__name__) | |
with open("nietzche.txt") as f: | |
text = f.read() | |
text_model = markovify.Text(text) | |
@app.route('/') | |
def api(): | |
""" | |
<>/ | |
The Main view for the API | |
return: JSON from markovify | |
""" | |
sentence = text_model.make_sentence() | |
return jsonify({"quote":sentence}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flask | |
markovify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment