Spaces:
Running
Running
File size: 482 Bytes
f5136c1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from flask import Flask, request, send_file
import os, json
app = Flask(__name__)
@app.route("/")
def home():
return '''true'''
@app.route("/get_states")
def get():
states = os.listdir("states")
states_parse = []
for s in states:
states_parse.append({"id":s, "text":open(f"states/{s}/text", "r").read()})
return json.dumps(states_parse)
@app.route("/states/<ide>/image.png")
def get_image(ide):
return send_file(f"states/{ide}/image.png")
app.run() |