Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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.
|
| 224 |
|
| 225 |
-
Now
|
| 226 |
{row_str}
|
| 227 |
|
| 228 |
-
|
| 229 |
-
1. Highlight
|
| 230 |
-
2.
|
| 231 |
-
3. Use 'increase'
|
| 232 |
-
4.
|
| 233 |
-
5.
|
|
|
|
|
|
|
| 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 |
|