Week 8 updates

This commit is contained in:
Edward Donner
2024-09-29 22:16:56 -04:00
parent c94d09b7dc
commit 196b6aea82
42 changed files with 2306 additions and 75267 deletions

18
week8/hello.py Normal file
View File

@@ -0,0 +1,18 @@
import modal
from modal import App, Image
# Setup
app = modal.App("hello")
image = Image.debian_slim().pip_install("requests")
# Hello!
@app.function(image=image)
def hello() -> str:
import requests
response = requests.get('https://ipinfo.io/json')
data = response.json()
city, region, country = data['city'], data['region'], data['country']
return f"Hello from {city}, {region}, {country}!!"