Numeri/main.py

28 lines
668 B
Python
Raw Normal View History

2022-09-18 13:11:54 +00:00
# based on https://gist.github.com/rduplain/1641344
import random
2022-09-22 15:15:32 +00:00
from io import BytesIO
import base64
from flask import Flask, make_response, request, render_template
2022-09-18 13:11:54 +00:00
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
2022-09-22 15:15:32 +00:00
import plots
2022-09-18 13:11:54 +00:00
app = Flask(__name__)
2022-09-18 13:11:54 +00:00
@app.route('/')
def my_form():
return render_template('index.html')
2022-09-18 13:11:54 +00:00
@app.route('/', methods=['POST'])
def my_form_post():
text = request.form['text']
processed_text = text.upper()
return processed_text
2022-09-18 13:11:54 +00:00
# @app.route('/')
# def plot_figure():
# return plots.plot()
2022-09-18 13:11:54 +00:00
if __name__ == '__main__':
app.run(debug=True, port=5002)