| import os | |
| import json | |
| import requests | |
| from games.snake.snake import snake | |
| game = snake() | |
| def process(command: str): | |
| url = f'https://{os.getenv("hfs_space")}.hf.space/games/snake' | |
| # url = 'http://127.0.0.1:8080/nlp' | |
| myobj = { | |
| 'command': command, | |
| } | |
| headers = {'Authorization': f'Bearer {os.getenv("hfs_token")}'} | |
| x = requests.post(url, json=myobj, headers=headers) | |
| print(x.text) | |
| # res1, _ = game.query_entry_point(command) | |
| return json.loads(x.text) | |