Spaces:
Sleeping
Sleeping
| import os | |
| from fastapi import FastAPI | |
| app = FastAPI() | |
| async def read_root(): | |
| return {"message": "Hello from the root!"} | |
| async def read_test(): | |
| return {"message": "Hello from the test endpoint!"} | |
| if __name__ == "__main__": | |
| import uvicorn | |
| # Use the PORT environment variable provided by Hugging Face, default to 7860 | |
| port = int(os.environ.get("PORT", "7860")) | |
| uvicorn.run(app, host="0.0.0.0", port=port) |