TxAgent-Api / app.py
Ali2206's picture
Update app.py
62d835c verified
raw
history blame
612 Bytes
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from config import setup_app
from endpoints import router
# Create the FastAPI app
app = FastAPI(title="TxAgent API", version="2.6.0")
# Apply CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
# Include the router with endpoints
app.include_router(router)
# Setup the app (e.g., initialize globals, startup event)
setup_app(app)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)