Cachoups commited on
Commit
1bfee56
·
verified ·
1 Parent(s): 6006ca3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -246,6 +246,24 @@ def generate_text(df, country, theme):
246
 
247
  Describe, using the similar pattern from the example, the changes for the provided country and years. Highlight how the values change year by year and whether they increased or decreased. Do not mention any other countries or years, and describe exactly what is in the table. Keep the description simple and direct.
248
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  prompt1 = f"""
250
  Here is an example of how to describe adverse growth data for a given country:
251
 
@@ -272,7 +290,7 @@ def generate_text(df, country, theme):
272
  """
273
 
274
  # Generate the descriptive text using the model
275
- result = table_to_text(prompt, max_length=240)[0]['generated_text']
276
 
277
  return result
278
  # Global variable
 
246
 
247
  Describe, using the similar pattern from the example, the changes for the provided country and years. Highlight how the values change year by year and whether they increased or decreased. Do not mention any other countries or years, and describe exactly what is in the table. Keep the description simple and direct.
248
  """
249
+ prompt = f"""
250
+ Here is an example of how to describe adverse growth data for a given country:
251
+ Country: Australia
252
+ Adverse 1990: -0.43%
253
+ Adverse 1991: -1.99%
254
+ Adverse 1992: -1.20%
255
+ Adverse Cumulative: -3.57%
256
+ Topic: GDP
257
+
258
+ Description:
259
+ In the adverse scenario, the GDP growth in Australia was -0.43% in 1990. It worsened to -1.99% in 1991 and slightly improved to -1.20% in 1992. The total cumulative adverse growth was -3.57%.
260
+
261
+ Now, using the following data for {theme} in {country}, describe the adverse growth:
262
+ {row_str}
263
+ Topic: {theme}
264
+
265
+ Your task is to describe the changes in the provided data year by year, just like in the example. Focus only on the provided country and values, and do not introduce any new countries or years. Ensure the description follows the pattern in the example, highlighting whether the values increased or decreased each year.
266
+ """
267
  prompt1 = f"""
268
  Here is an example of how to describe adverse growth data for a given country:
269
 
 
290
  """
291
 
292
  # Generate the descriptive text using the model
293
+ result = table_to_text(prompt, max_length=240, temperature = 0.7, do_sample = True)[0]['generated_text']
294
 
295
  return result
296
  # Global variable