Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| app = FastAPI() | |
| current_command = None | |
| class Command(BaseModel): | |
| action: str | |
| x: int | |
| y: int | |
| async def send_command(command: Command): | |
| global current_command | |
| current_command = command | |
| return {"status": "command_received"} | |
| async def get_command(): | |
| return current_command | |
| def home(): | |
| return "welcome to our world!" | |
| if __name__ == '__main__': | |
| import uvicorn | |
| uvicorn.run(app, host='0.0.0.0', port=8000) | |