Spaces:
Sleeping
Sleeping
Download prototypes/hello.py from MightyOctopus/worth-brain: direct link, hf CLI and curl.
- Browser
- Download file 823 Bytes
-
https://huggingface.co/spaces/MightyOctopus/worth-brain/resolve/main/prototypes/hello.py
- Command line
-
hf download hf://spaces/MightyOctopus/worth-brain/prototypes/hello.py
-
curl -L -o hello.py https://huggingface.co/spaces/MightyOctopus/worth-brain/resolve/main/prototypes/hello.py
823 Bytes
| from importlib import import_module | |
| import modal | |
| from modal import App, Image | |
| ### Setup | |
| app = modal.App("hello") | |
| image = Image.debian_slim().pip_install("requests") | |
| ### Hello functions | |
| def hello() -> str: | |
| import requests | |
| response = requests.get("https://ipinfo.io/json") | |
| data = response.json() | |
| print("DATA: ", data) | |
| city, region, country = data["city"], data["region"], data["country"] | |
| return f"Hello from {city}, {region}, {country}!!" | |
| def hello_europe() -> str: | |
| import requests | |
| response = requests.get("https://ipinfo.io/json") | |
| data = response.json() | |
| print("DATA: ", data) | |
| city, region, country = data["city"], data["region"], data["country"] | |
| return f"Hello from {city}, {region}, {country}!!" | |