Cachoups commited on
Commit
1dedc0a
·
verified ·
1 Parent(s): 8589fad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -206,25 +206,26 @@ def generate_text(df, country, theme):
206
 
207
  # Create the prompt
208
  prompt = f"""
209
- Here is an example of summarizing adverse growth data:
210
 
211
  Example for France:
212
  Country: France
213
- Adverse 2020: 0.643631
214
- Adverse 2021: -0.493879
215
- Adverse 2022: -0.785046
216
- Adverse Cumulative: -0.639624
217
 
218
  The theme is GDP.
219
  Summary:
220
- In the adverse scenario, the growth for GDP in France increased by 0.643631% in 2020 but decreased significantly by -0.493879% in 2021 and further decreased by -0.785046% in 2022, resulting in an adverse cumulative decrease of -0.639624%.
221
 
222
  Now, summarize the adverse scenario growth for {theme} in {country} based on the following data:
223
  {row_str}
224
 
225
- Please ensure to follow this format and use the terms 'increase' or 'decrease' based on whether the values go up or down from the previous year. Explicitly mention if the growth increased or decreased compared to the previous year and include a cumulative result if applicable.
226
  """
227
 
 
228
  # Generate the descriptive text using the model
229
  result = table_to_text(prompt, max_length=200)[0]['generated_text']
230
 
 
206
 
207
  # Create the prompt
208
  prompt = f"""
209
+ Here is an example of how to summarize adverse growth data for a given country:
210
 
211
  Example for France:
212
  Country: France
213
+ Adverse 2020: -0.427975
214
+ Adverse 2021: -1.987167
215
+ Adverse 2022: -1.195906
216
+ Adverse Cumulative: -3.573762
217
 
218
  The theme is GDP.
219
  Summary:
220
+ In the adverse scenario, the growth for GDP in France decreased by -0.427975% in 2020, worsened further by -1.987167% in 2021, and slightly improved by -1.195906% in 2022, resulting in an adverse cumulative decrease of -3.573762%.
221
 
222
  Now, summarize the adverse scenario growth for {theme} in {country} based on the following data:
223
  {row_str}
224
 
225
+ Follow the pattern from the example and explicitly mention 'increase' or 'decrease' based on the changes in the values from the previous year. Ensure that you highlight any improvement or worsening compared to previous years and include a cumulative result if applicable.
226
  """
227
 
228
+
229
  # Generate the descriptive text using the model
230
  result = table_to_text(prompt, max_length=200)[0]['generated_text']
231