Closed GHCamille closed 3 months ago
Hey @GHCamille 👋🏼
I have an additional question. How is this function expected to be used? Will @MateoLostanlen add the pyro-risk repo to the app backend directly? Or something else (using the API for example)
Thx 😃
I'm not sure how @MateoLostanlen wants to use it ! @MateoLostanlen any ideas ?
Hello @Acruve15 @GHCamille, Hi, there,
Sorry for the late reply, ideally the less you install on the pi the better. Especially since installing a whole repo for one request doesn't seem very adapted. The best thing would be to deploy a small api that the pi can easily call. Is that feasible for you? Do you need help ?
smothing like this :
import requests
def get_risk_score(lat, lon):
url = "https://example.com/risk_score"
params = {
'lat': lat,
'lon': lon
}
try:
response = requests.get(url, params=params)
response.raise_for_status() # Check if the request failed
data = response.json() # Assume the API returns a JSON response
return data['risk_score'] # Assume the risk score is under the 'risk_score' key
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
return None
Add function to get the fwi score for a specific lat lon.