Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -211,23 +211,21 @@ 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
|
215 |
-
|
216 |
Country: Australia
|
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
|
223 |
-
|
224 |
-
Now
|
225 |
{row_str}
|
226 |
-
|
227 |
-
|
228 |
-
1. Highlight any improvement or worsening compared to previous years.
|
229 |
-
2. Include the cumulative result if applicable.
|
230 |
-
3. Ensure the summary reflects the changes in values accurately.
|
231 |
"""
|
232 |
|
233 |
|
@@ -237,7 +235,7 @@ def generate_text(df, country, theme):
|
|
237 |
|
238 |
|
239 |
# Generate the descriptive text using the model
|
240 |
-
result = table_to_text(prompt, max_length=200)[0]['generated_text']
|
241 |
|
242 |
return result
|
243 |
# 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 for a given country:
|
|
|
215 |
Country: Australia
|
216 |
Adverse 2020: -0.427975
|
217 |
Adverse 2021: -1.987167
|
218 |
Adverse 2022: -1.195906
|
219 |
Adverse Cumulative: -3.573762
|
220 |
+
|
221 |
+
The topic is GDP.
|
222 |
Summary:
|
223 |
+
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%.
|
224 |
+
|
225 |
+
Now, use the following data for {theme} in {country} to generate a similar summary:
|
226 |
{row_str}
|
227 |
+
|
228 |
+
The topic is {theme}. Ensure that the summary reflects the theme accurately and follows the pattern from the example. Highlight any improvements or worsening compared to previous years and include a cumulative result if applicable. Use terms 'increase' and 'decrease' to describe changes in values, and make sure the output aligns with the provided data.
|
|
|
|
|
|
|
229 |
"""
|
230 |
|
231 |
|
|
|
235 |
|
236 |
|
237 |
# Generate the descriptive text using the model
|
238 |
+
result = table_to_text(prompt, max_length=200, temperature = 0.7, top_p = 0.9)[0]['generated_text']
|
239 |
|
240 |
return result
|
241 |
# Global variable
|