Spaces:
Runtime error
Runtime error
added formatting of synthesis
Browse files- app.py +21 -3
- func_utils.py +10 -3
- prompts/summary_prompt.py +1 -2
- summary_test.py +2 -3
- visualize/visualize.py +1 -1
app.py
CHANGED
@@ -168,6 +168,21 @@ with gr.Blocks() as demo:
|
|
168 |
background: var(--button-secondary-background-fill-hover);
|
169 |
color: var(--button-secondary-text-color-hover)
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
</style>
|
173 |
"""
|
@@ -283,10 +298,10 @@ with gr.Blocks() as demo:
|
|
283 |
gr.HTML(
|
284 |
"<h2 style='color: #000000'>Déficit hydrique</h2>"
|
285 |
)
|
286 |
-
gr.Plot()
|
287 |
with gr.Column():
|
288 |
gr.HTML("<h2 style='color: #000000'>Rendements</h2>")
|
289 |
-
gr.Plot()
|
290 |
with gr.Tab(
|
291 |
label="Prévisions pour l'exploitation avec ombrage", scale=1
|
292 |
):
|
@@ -301,7 +316,7 @@ with gr.Blocks() as demo:
|
|
301 |
gr.HTML(
|
302 |
"<h2 style='color: #000000'>Déficit hydrique</h2>"
|
303 |
)
|
304 |
-
gr.Plot()
|
305 |
with gr.Column():
|
306 |
gr.HTML("<h2 style='color: #000000'>Rendements</h2>")
|
307 |
shaded_plot_yields = gr.Plot()
|
@@ -329,6 +344,9 @@ with gr.Blocks() as demo:
|
|
329 |
plot_1,
|
330 |
plot_2,
|
331 |
plot_3,
|
|
|
|
|
|
|
332 |
shaded_plot_yields,
|
333 |
page_1,
|
334 |
page_2,
|
|
|
168 |
background: var(--button-secondary-background-fill-hover);
|
169 |
color: var(--button-secondary-text-color-hover)
|
170 |
}
|
171 |
+
h3 {
|
172 |
+
color:black !important;
|
173 |
+
}
|
174 |
+
h4 {
|
175 |
+
color:black !important;
|
176 |
+
}
|
177 |
+
ul {
|
178 |
+
color:black !important;
|
179 |
+
}
|
180 |
+
li {
|
181 |
+
color:black !important;
|
182 |
+
}
|
183 |
+
strong {
|
184 |
+
color:black !important;
|
185 |
+
}
|
186 |
|
187 |
</style>
|
188 |
"""
|
|
|
298 |
gr.HTML(
|
299 |
"<h2 style='color: #000000'>Déficit hydrique</h2>"
|
300 |
)
|
301 |
+
plot_4 = gr.Plot()
|
302 |
with gr.Column():
|
303 |
gr.HTML("<h2 style='color: #000000'>Rendements</h2>")
|
304 |
+
current_plot_yields = gr.Plot()
|
305 |
with gr.Tab(
|
306 |
label="Prévisions pour l'exploitation avec ombrage", scale=1
|
307 |
):
|
|
|
316 |
gr.HTML(
|
317 |
"<h2 style='color: #000000'>Déficit hydrique</h2>"
|
318 |
)
|
319 |
+
plot_5 = gr.Plot()
|
320 |
with gr.Column():
|
321 |
gr.HTML("<h2 style='color: #000000'>Rendements</h2>")
|
322 |
shaded_plot_yields = gr.Plot()
|
|
|
344 |
plot_1,
|
345 |
plot_2,
|
346 |
plot_3,
|
347 |
+
plot_4,
|
348 |
+
plot_5,
|
349 |
+
current_plot_yields,
|
350 |
shaded_plot_yields,
|
351 |
page_1,
|
352 |
page_2,
|
func_utils.py
CHANGED
@@ -4,6 +4,8 @@ import gradio as gr
|
|
4 |
|
5 |
|
6 |
from compute_yield import plot_yield
|
|
|
|
|
7 |
from visualize.visualize import get_plots
|
8 |
|
9 |
|
@@ -69,10 +71,12 @@ def go_to_page_2():
|
|
69 |
|
70 |
|
71 |
def launch_simulation(lat, lon, address, culture):
|
72 |
-
current_situation_summary =
|
73 |
-
agripv_summary = "bidule"
|
74 |
page1, page_2 = go_to_page_2()
|
75 |
-
plot_1, plot_2, plot_3 = get_plots()
|
|
|
|
|
|
|
76 |
shaded_plot_yields = plot_yield(
|
77 |
latitude=lat, longitude=lon, culture=culture, shading_coef=0.2
|
78 |
)
|
@@ -82,6 +86,9 @@ def launch_simulation(lat, lon, address, culture):
|
|
82 |
plot_1,
|
83 |
plot_2,
|
84 |
plot_3,
|
|
|
|
|
|
|
85 |
shaded_plot_yields,
|
86 |
page1,
|
87 |
page_2,
|
|
|
4 |
|
5 |
|
6 |
from compute_yield import plot_yield
|
7 |
+
from summary_test import get_summaries
|
8 |
+
|
9 |
from visualize.visualize import get_plots
|
10 |
|
11 |
|
|
|
71 |
|
72 |
|
73 |
def launch_simulation(lat, lon, address, culture):
|
74 |
+
current_situation_summary, agripv_summary = get_summaries()
|
|
|
75 |
page1, page_2 = go_to_page_2()
|
76 |
+
plot_1, plot_2, plot_3, plot_4, plot_5 = get_plots()
|
77 |
+
current_plot_yields = plot_yield(
|
78 |
+
latitude=lat, longitude=lon, culture=culture, shading_coef=0
|
79 |
+
)
|
80 |
shaded_plot_yields = plot_yield(
|
81 |
latitude=lat, longitude=lon, culture=culture, shading_coef=0.2
|
82 |
)
|
|
|
86 |
plot_1,
|
87 |
plot_2,
|
88 |
plot_3,
|
89 |
+
plot_4,
|
90 |
+
plot_5,
|
91 |
+
current_plot_yields,
|
92 |
shaded_plot_yields,
|
93 |
page1,
|
94 |
page_2,
|
prompts/summary_prompt.py
CHANGED
@@ -48,8 +48,7 @@ agricultural_yield_comparison_prompt = """
|
|
48 |
|
49 |
Consignes pour la réponse :
|
50 |
- Fournir une analyse détaillée, structurée et pédagogique.
|
51 |
-
- S’appuyer exclusivement sur les données fournies et argumenter à l’aide d’indicateurs précis concernant l’évolution des variables
|
52 |
-
- Adopter une approche objective et non biaisée, sans favoriser un scénario par anticipation.
|
53 |
- Vulgariser les concepts techniques pour assurer une compréhension optimale par l’agriculteur.
|
54 |
- Le format de sortie doit être structuré, avec des sections claires et bien définies.
|
55 |
- L’utilisateur vous fournira le nom de la culture, les caractéristiques du sol dans la région concernée ainsi que les données de rendement avec et sans ombrage
|
|
|
48 |
|
49 |
Consignes pour la réponse :
|
50 |
- Fournir une analyse détaillée, structurée et pédagogique.
|
51 |
+
- S’appuyer exclusivement sur les données fournies et argumenter à l’aide d’indicateurs précis concernant l’évolution des variables. Donnes des pourcentages pas des valeurs d'indicateurs! - Adopter une approche objective et non biaisée, sans favoriser un scénario par anticipation.
|
|
|
52 |
- Vulgariser les concepts techniques pour assurer une compréhension optimale par l’agriculteur.
|
53 |
- Le format de sortie doit être structuré, avec des sections claires et bien définies.
|
54 |
- L’utilisateur vous fournira le nom de la culture, les caractéristiques du sol dans la région concernée ainsi que les données de rendement avec et sans ombrage
|
summary_test.py
CHANGED
@@ -62,8 +62,7 @@ def get_yield_data(region: str = "Bourgogne-Franche-Comté", culture: str ="Blé
|
|
62 |
return yield_past_data[["year", "past_yield"]], yield_forecast_data[["year", "yield_simple_forecast", "yield_with_shading_forecast"]]
|
63 |
|
64 |
|
65 |
-
|
66 |
-
|
67 |
scenario = "pessimist"
|
68 |
lat, lon = 47.0, 5.0
|
69 |
culture = "Blé tendre d'hiver"
|
@@ -106,7 +105,7 @@ if __name__ == "__main__":
|
|
106 |
|
107 |
print(yield_forecast_data.tail())
|
108 |
print(second_summary)
|
109 |
-
|
110 |
# from utils.soil_utils import find_nearest_point
|
111 |
# city = "Bourgogne Franche Comté"
|
112 |
# closest_soil_features = find_nearest_point(city)
|
|
|
62 |
return yield_past_data[["year", "past_yield"]], yield_forecast_data[["year", "yield_simple_forecast", "yield_with_shading_forecast"]]
|
63 |
|
64 |
|
65 |
+
def get_summaries():
|
|
|
66 |
scenario = "pessimist"
|
67 |
lat, lon = 47.0, 5.0
|
68 |
culture = "Blé tendre d'hiver"
|
|
|
105 |
|
106 |
print(yield_forecast_data.tail())
|
107 |
print(second_summary)
|
108 |
+
return meterological_summary, second_summary
|
109 |
# from utils.soil_utils import find_nearest_point
|
110 |
# city = "Bourgogne Franche Comté"
|
111 |
# closest_soil_features = find_nearest_point(city)
|
visualize/visualize.py
CHANGED
@@ -384,4 +384,4 @@ def get_plots():
|
|
384 |
)
|
385 |
)
|
386 |
plots.append(plot_ombrage)
|
387 |
-
return plots
|
|
|
384 |
)
|
385 |
)
|
386 |
plots.append(plot_ombrage)
|
387 |
+
return plots
|