Cachoups commited on
Commit
c9afbab
·
verified ·
1 Parent(s): 2f0f1dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -211,26 +211,27 @@ 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 country with GDP as the topic:
215
 
216
  Country: France
217
  Adverse 2020: -0.427975
218
  Adverse 2021: -1.987167
219
  Adverse 2022: -1.195906
220
  Adverse Cumulative: -3.573762
221
-
222
  Summary:
223
- In the adverse scenario, the GDP growth for 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%.
224
 
225
- Now, summarize the data for {theme} in {country}:
226
  {row_str}
227
 
228
- Ensure the following:
229
- 1. Highlight changes from previous years.
230
- 2. Include a cumulative result if applicable.
231
- 3. Use 'increase' if the value is positive and 'decrease' if the value is negative.
232
- 4. The summary should reflect the data accurately.
233
- 5. Do not use the example's topic (GDP) or its format. Focus on the given data and topic.
 
 
234
  """
235
 
236
 
@@ -238,6 +239,7 @@ def generate_text(df, country, theme):
238
 
239
 
240
 
 
241
  # Generate the descriptive text using the model
242
  result = table_to_text(prompt, max_length=200, temperature=0.7, top_p=0.9)[0]['generated_text']
243
 
 
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 with GDP as the topic:
215
 
216
  Country: France
217
  Adverse 2020: -0.427975
218
  Adverse 2021: -1.987167
219
  Adverse 2022: -1.195906
220
  Adverse Cumulative: -3.573762
 
221
  Summary:
222
+ In the adverse scenario, the GDP growth for France decreased by 0.43% in 2020, worsened further by 1.99% in 2021, and slightly improved by -1.20% in 2022. The cumulative adverse growth is -3.57%.
223
 
224
+ Now summarize the adverse scenario growth for {theme} as the topic using the following data:
225
  {row_str}
226
 
227
+ Instructions:
228
+ 1. Highlight any improvement or worsening compared to previous years.
229
+ 2. Clearly state if values are increasing or decreasing.
230
+ 3. Use 'increase' for positive values and 'decrease' for negative values.
231
+ 4. Include the cumulative result if applicable.
232
+ 5. Ensure the summary reflects the changes in values accurately.
233
+
234
+ For instance, if the value is positive, it represents an increase, and if it is negative, it represents a decrease. Clearly reflect this in your summary.
235
  """
236
 
237
 
 
239
 
240
 
241
 
242
+
243
  # Generate the descriptive text using the model
244
  result = table_to_text(prompt, max_length=200, temperature=0.7, top_p=0.9)[0]['generated_text']
245