Spaces:
Running
Running
Joffrey THOMAS commited on
Commit ·
8665f5d
1
Parent(s): 297ff84
typing
Browse files15 unmodified lines1617181920212227 unmodified lines505152535455565758596061626315 unmodified lines# --- Imports for poke_env and agents ---from poke_env.player import Playerfrom poke_env import AccountConfiguration, ServerConfigurationfrom poke_env.environment.battle import Battle# Import the actual agent classesfrom agents import OpenAIAgent, GeminiAgent, MistralAgent27 unmodified linesactive_agent_name: Optional[str] = Noneactive_agent_instance: Optional[Player] = Noneactive_agent_task: Optional[asyncio.Task] = Nonecurrent_battle_instance: Optional[Battle] = Nonebackground_task_handle: Optional[asyncio.Task] = None# --- Create FastAPI app ---app = FastAPI(title="Pokemon Battle Livestream")# --- Helper Functions ---def get_active_battle(agent: Player) -> Optional[Battle]:"""Returns the first non-finished battle for an agent."""if agent and agent._battles:active_battles = [b for b in agent._battles.values() if not b.finished]15 unmodified lines1617181920212227 unmodified lines505152535455565758596061626315 unmodified lines# --- Imports for poke_env and agents ---from poke_env.player import Playerfrom poke_env import AccountConfiguration, ServerConfiguration# from poke_env.environment.battle import Battle# Import the actual agent classesfrom agents import OpenAIAgent, GeminiAgent, MistralAgent27 unmodified linesactive_agent_name: Optional[str] = Noneactive_agent_instance: Optional[Player] = Noneactive_agent_task: Optional[asyncio.Task] = Nonecurrent_battle_instance = Nonebackground_task_handle: Optional[asyncio.Task] = None# --- Create FastAPI app ---app = FastAPI(title="Pokemon Battle Livestream")# --- Helper Functions ---def get_active_battle(agent: Player):"""Returns the first non-finished battle for an agent."""if agent and agent._battles:active_battles = [b for b in agent._battles.values() if not b.finished]
main.py+3-3