Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -204,12 +204,37 @@ def generate_text(df, country, theme):
|
|
| 204 |
# Convert the row to a string format for prompt
|
| 205 |
row_str = row.to_string(index=True)
|
| 206 |
|
| 207 |
-
|
| 208 |
Here is the data for {theme} in {country}:
|
| 209 |
{row_str}
|
| 210 |
|
| 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 |
|
| 214 |
|
| 215 |
|
|
|
|
| 204 |
# Convert the row to a string format for prompt
|
| 205 |
row_str = row.to_string(index=True)
|
| 206 |
|
| 207 |
+
simple_prompt = f"""
|
| 208 |
Here is the data for {theme} in {country}:
|
| 209 |
{row_str}
|
| 210 |
|
| 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 with GDP as the theme:
|
| 215 |
+
|
| 216 |
+
Example for France (GDP):
|
| 217 |
+
Country: France
|
| 218 |
+
Adverse 2020: -0.427975
|
| 219 |
+
Adverse 2021: -1.987167
|
| 220 |
+
Adverse 2022: -1.195906
|
| 221 |
+
Adverse Cumulative: -3.573762
|
| 222 |
+
|
| 223 |
+
The theme is GDP.
|
| 224 |
+
Summary:
|
| 225 |
+
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. The cumulative adverse growth is -3.573762%.
|
| 226 |
+
|
| 227 |
+
Now, use the following data for {theme} in {country} to generate a summary:
|
| 228 |
+
{row_str}
|
| 229 |
+
|
| 230 |
+
The theme is {theme}. For the data provided:
|
| 231 |
+
- Highlight any improvement or worsening compared to previous years.
|
| 232 |
+
- Include a cumulative result if applicable.
|
| 233 |
+
- Use the terms 'increase' and 'decrease' to describe the changes.
|
| 234 |
+
- Ensure that the summary reflects the data accurately and follows the pattern of the example.
|
| 235 |
+
|
| 236 |
+
For instance, if the data shows an improvement or worsening trend, explicitly state this in the summary.
|
| 237 |
+
"""
|
| 238 |
|
| 239 |
|
| 240 |
|