Spaces:
Paused
Paused
Download handler.py from andronasef/googleit-server: direct link, hf CLI and curl.
- Browser
- Download file 318 Bytes
-
https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/handler.py
- Command line
-
hf download hf://spaces/andronasef/googleit-server/handler.py
-
curl -L -o handler.py https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/handler.py
318 Bytes
| import json | |
| from search import search | |
| from suggest import suggest | |
| def handler(action, query): | |
| action = action.lower() | |
| res = {"msg": "Failed to handle request"} | |
| if action == "search": | |
| res = search(query) | |
| elif action == "autosuggest": | |
| res = suggest(query) | |
| return json.dumps(res) | |