from fastapi import FastAPI from fastapi.responses import HTMLResponse import uvicorn import os api = FastAPI() templates = os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates") @api.get("/chat_example") def base(): with open(os.path.join(templates, "index.html"), "r") as f: content = f.read() return HTMLResponse(content) @api.get("/") def base(): with open(os.path.join(templates, "base.html"), "r") as f: content = f.read() return HTMLResponse(content) if __name__ == '__main__': uvicorn.run("main:api", host="localhost", port=5050)