Spaces:
Runtime error
Runtime error
added select button for cultures
Browse files- app.py +2 -41
- summary_test.py +2 -2
- utils/soil_utils.py +1 -1
app.py
CHANGED
|
@@ -6,45 +6,6 @@ import pandas as pd
|
|
| 6 |
|
| 7 |
|
| 8 |
import os
|
| 9 |
-
|
| 10 |
-
title = "Démo GAIA - Les bénéfices de l'ombrage"
|
| 11 |
-
description = "Example of simple chatbot with Gradio and Mistral AI via its API"
|
| 12 |
-
# placeholder = "Posez moi une question sur l'agriculture"
|
| 13 |
-
# examples = ["Je suis un agriculture basé pas loin de bordeaux et je cultive du mais et je cherche des recommandations d'autres cultures mieux adapté aux changements climatique ?",
|
| 14 |
-
# "Je suis un agriculteur basé au sud de la France vers Nice, je cherche des recommandations de cultures mieux adapté aux changements climatiques ?",]
|
| 15 |
-
|
| 16 |
-
# #api_key = os.environ.get("MISTRAL_API_KEY")
|
| 17 |
-
# #client = MistralClient(api_key=api_key)
|
| 18 |
-
# #client = Mistral(api_key=api_key)
|
| 19 |
-
# #model = 'open-mixtral-8x7b'
|
| 20 |
-
# """
|
| 21 |
-
# def chat_with_mistral(user_input, history):
|
| 22 |
-
# messages = [{"role": "user", "content": user_input}]
|
| 23 |
-
|
| 24 |
-
# chat_response = client.chat.complete(model=model, messages=messages)P
|
| 25 |
-
# return chat_response.choices[0].message.content
|
| 26 |
-
# """
|
| 27 |
-
|
| 28 |
-
# def chat_with_agrienergy(user_input, history):
|
| 29 |
-
# messages = [{"role": "user", "content": user_input}]
|
| 30 |
-
# result = kickoff(user_input=user_input)
|
| 31 |
-
# return f"{result}"
|
| 32 |
-
|
| 33 |
-
# iface = gr.ChatInterface(
|
| 34 |
-
# fn=chat_with_agrienergy,
|
| 35 |
-
# chatbot=gr.Chatbot(height=300),
|
| 36 |
-
# textbox=gr.Textbox(placeholder=placeholder, container=False, scale=7),
|
| 37 |
-
# title=title,
|
| 38 |
-
# description=description,
|
| 39 |
-
# theme="soft",
|
| 40 |
-
# examples=examples,
|
| 41 |
-
# cache_examples=False,
|
| 42 |
-
# )
|
| 43 |
-
|
| 44 |
-
# iface.launch(share=True)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
# import gradio as gr
|
| 48 |
from func_utils import *
|
| 49 |
from summary_test import generate_irradiance_trend, get_mocked_summary
|
| 50 |
|
|
@@ -120,8 +81,8 @@ with gr.Blocks() as demo:
|
|
| 120 |
)
|
| 121 |
|
| 122 |
with gr.Row(elem_classes="box"):
|
| 123 |
-
culture = gr.
|
| 124 |
-
label="Culture", scale=1, elem_classes="culture_box"
|
| 125 |
)
|
| 126 |
|
| 127 |
with gr.Column(variant="panel", scale=3):
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from func_utils import *
|
| 10 |
from summary_test import generate_irradiance_trend, get_mocked_summary
|
| 11 |
|
|
|
|
| 81 |
)
|
| 82 |
|
| 83 |
with gr.Row(elem_classes="box"):
|
| 84 |
+
culture = gr.Dropdown(
|
| 85 |
+
label="Culture", scale=1, elem_classes="culture_box", choices=["Blé", "Colza", "Orge"]
|
| 86 |
)
|
| 87 |
|
| 88 |
with gr.Column(variant="panel", scale=3):
|
summary_test.py
CHANGED
|
@@ -103,10 +103,10 @@ def get_shaded_summary():
|
|
| 103 |
import pandas as pd
|
| 104 |
import numpy as np
|
| 105 |
|
| 106 |
-
from utils.soil_utils import
|
| 107 |
|
| 108 |
city = "Bourgogne Franche Comté"
|
| 109 |
-
closest_soil_features =
|
| 110 |
print(closest_soil_features)
|
| 111 |
|
| 112 |
# Définir la période de 4 ans dans le passé + 15 ans dans le futur (19 ans)
|
|
|
|
| 103 |
import pandas as pd
|
| 104 |
import numpy as np
|
| 105 |
|
| 106 |
+
from utils.soil_utils import find_nearest_point_to_city
|
| 107 |
|
| 108 |
city = "Bourgogne Franche Comté"
|
| 109 |
+
closest_soil_features = find_nearest_point_to_city(city)
|
| 110 |
print(closest_soil_features)
|
| 111 |
|
| 112 |
# Définir la période de 4 ans dans le passé + 15 ans dans le futur (19 ans)
|
utils/soil_utils.py
CHANGED
|
@@ -5,7 +5,7 @@ from shapely.geometry import Point
|
|
| 5 |
|
| 6 |
load_dotenv()
|
| 7 |
|
| 8 |
-
file_rmqs ='
|
| 9 |
df = gpd.read_file(file_rmqs)
|
| 10 |
|
| 11 |
def get_city_coordinates(city_name):
|
|
|
|
| 5 |
|
| 6 |
load_dotenv()
|
| 7 |
|
| 8 |
+
file_rmqs ='data/soil_data/raw_data/rmqs.geojson'
|
| 9 |
df = gpd.read_file(file_rmqs)
|
| 10 |
|
| 11 |
def get_city_coordinates(city_name):
|