Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
210 |
|
211 |
Example for France:
|
212 |
Country: France
|
213 |
-
Adverse 2020: 0.
|
214 |
-
Adverse 2021: -
|
215 |
-
Adverse 2022: -
|
216 |
-
Adverse Cumulative: -
|
217 |
|
218 |
The theme is GDP.
|
219 |
Summary:
|
220 |
-
In the adverse scenario, the growth for GDP in France
|
221 |
|
222 |
Now, summarize the adverse scenario growth for {theme} in {country} based on the following data:
|
223 |
{row_str}
|
224 |
|
225 |
-
|
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 |
|