Spaces:
Sleeping
Sleeping
Achille Thin - Genesis
commited on
Commit
·
4321294
1
Parent(s):
8e8a4e2
by hectare prompt modifying
Browse files
app.py
CHANGED
@@ -52,14 +52,14 @@ query_engine = index.as_query_engine(similarity_top_k=10)
|
|
52 |
|
53 |
def create_prompt(farmSize, cultures):
|
54 |
prompt = f"""
|
55 |
-
You are a French agronomical advisor, answering in French. Your task is to provide an concise advice as a table of rotation crops (with a prioritary suggestion and an alternative one) to the farmer what to seed in the next year and in which proportion. You will be given the historical information about the farmer, and context data given previously gives you average performances in yield per
|
56 |
#facts
|
57 |
The farm area is {farmSize} ha.
|
58 |
"""
|
59 |
for i, culture in enumerate(cultures):
|
60 |
prompt += f"Parcel {i+1} most recently grew {culture}."
|
61 |
prompt += """I need you to answer in French formulating a concise table with the crops you want to grow and by parcel, and predicting gross margin per hectare according to the scenario asked for (mean, pessimistic or optimistic. Default: mean).
|
62 |
-
Réponds en français en formulant un tableau concis avec les cultures que tu veux cultiver et par parcelle, et en prévoyant la marge et le coût par hectare selon le scénario demandé (moyen, pessimiste ou optimiste. Par défaut : moyen).\n"
|
63 |
"""
|
64 |
return prompt
|
65 |
|
@@ -79,7 +79,7 @@ def find_my_rotation(department: str, farmSize: float, benefitsFromCommonAgricul
|
|
79 |
dpt_yield = pd.read_csv(f'data/departments/{department_name}.csv')
|
80 |
yield_text = ''
|
81 |
for i, row in dpt_yield.iterrows():
|
82 |
-
yield_text += f"Dans le département de {department_name}, la production de {row['Culture'].split('-')[1]} est de {row['mean']} en moyenne, de {row['pessimistic']} avec un scenario pessimiste et de {row['optimistic']} avec un scenario optimiste. "
|
83 |
# Create the prompt
|
84 |
index.insert(Document(text=yield_text))
|
85 |
prompt = create_prompt(farmSize, cultures)
|
|
|
52 |
|
53 |
def create_prompt(farmSize, cultures):
|
54 |
prompt = f"""
|
55 |
+
You are a French agronomical advisor, answering in French. Your task is to provide an concise advice as a table of rotation crops (with a prioritary suggestion and an alternative one) to the farmer what to seed in the next year and in which proportion. You will be given the historical information about the farmer, and context data given previously gives you average performances in yield per hectare by region and by culture, as well as production costs and selling prices. Consider agronomical limitation and provide advice to the farmer to maximize his profit (maximum yield and revenue -- (the difference between the selling price and the cost of production) times the yield). There are three possible scenarii, pessimistic (lowest revenue), optimistic (highest revenue) and mean.
|
56 |
#facts
|
57 |
The farm area is {farmSize} ha.
|
58 |
"""
|
59 |
for i, culture in enumerate(cultures):
|
60 |
prompt += f"Parcel {i+1} most recently grew {culture}."
|
61 |
prompt += """I need you to answer in French formulating a concise table with the crops you want to grow and by parcel, and predicting gross margin per hectare according to the scenario asked for (mean, pessimistic or optimistic. Default: mean).
|
62 |
+
Réponds en français en formulant un tableau concis avec les cultures que tu veux cultiver et par parcelle, et en prévoyant la marge brute et le coût par hectare selon le scénario demandé (moyen, pessimiste ou optimiste. Par défaut : moyen).\n"
|
63 |
"""
|
64 |
return prompt
|
65 |
|
|
|
79 |
dpt_yield = pd.read_csv(f'data/departments/{department_name}.csv')
|
80 |
yield_text = ''
|
81 |
for i, row in dpt_yield.iterrows():
|
82 |
+
yield_text += f"Dans le département de {department_name}, la production de {row['Culture'].split('-')[1]} est de {row['mean']} en moyenne par hectare, de {row['pessimistic']} par hectare avec un scenario pessimiste et de {row['optimistic']} par hectare avec un scenario optimiste. "
|
83 |
# Create the prompt
|
84 |
index.insert(Document(text=yield_text))
|
85 |
prompt = create_prompt(farmSize, cultures)
|