Cachoups commited on
Commit
65106f7
·
verified ·
1 Parent(s): b90a585

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -211,7 +211,7 @@ def generate_text(df, country, theme):
211
  Summarize the adverse growth for {theme} in {country}. Highlight any increase or decrease compared to previous years and include the cumulative result.
212
  """
213
  prompt = f"""
214
- Here is an example of how to summarize adverse growth data for a given country with GDP as the theme:
215
 
216
  Example for France (GDP):
217
  Country: France
@@ -220,26 +220,25 @@ def generate_text(df, country, theme):
220
  Adverse 2022: -1.195906
221
  Adverse Cumulative: -3.573762
222
 
223
- The theme is GDP.
224
  Summary:
225
  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. The cumulative adverse growth is -3.573762%.
226
 
227
- Now, use the following data for {theme} in {country} to generate a summary:
228
  {row_str}
229
 
230
  The theme is {theme}. For the data provided:
231
- - Highlight any improvement or worsening compared to previous years.
232
- - Include a cumulative result if applicable.
233
- - Use the terms 'increase' and 'decrease' to describe the changes.
234
- - Ensure that the summary reflects the data accurately and follows the pattern of the example.
235
 
236
- For instance, if the data shows an improvement or worsening trend, explicitly state this in the summary.
237
  """
238
 
239
 
240
 
 
241
  # Generate the descriptive text using the model
242
- result = table_to_text(prompt, max_length=200)[0]['generated_text']
243
 
244
  return result
245
  # Global variable
 
211
  Summarize the adverse growth for {theme} in {country}. Highlight any increase or decrease compared to previous years and include the cumulative result.
212
  """
213
  prompt = f"""
214
+ Here is an example of how to summarize adverse growth data:
215
 
216
  Example for France (GDP):
217
  Country: France
 
220
  Adverse 2022: -1.195906
221
  Adverse Cumulative: -3.573762
222
 
 
223
  Summary:
224
  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. The cumulative adverse growth is -3.573762%.
225
 
226
+ Now summarize the following data for {theme} in {country}:
227
  {row_str}
228
 
229
  The theme is {theme}. For the data provided:
230
+ - Mention if the values have increased or decreased compared to previous years.
231
+ - Include the cumulative result if available.
232
+ - Follow the format in the example.
 
233
 
234
+ Ensure the summary reflects the changes in the values clearly.
235
  """
236
 
237
 
238
 
239
+
240
  # Generate the descriptive text using the model
241
+ result = table_to_text(prompt, max_length=200, temperature=0.7, top_p=0.9)[0]['generated_text']
242
 
243
  return result
244
  # Global variable