Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -211,7 +211,7 @@ 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 |
Example for France (GDP):
|
217 |
Country: France
|
@@ -220,26 +220,25 @@ def generate_text(df, country, theme):
|
|
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
|
228 |
{row_str}
|
229 |
|
230 |
The theme is {theme}. For the data provided:
|
231 |
-
-
|
232 |
-
- Include
|
233 |
-
-
|
234 |
-
- Ensure that the summary reflects the data accurately and follows the pattern of the example.
|
235 |
|
236 |
-
|
237 |
"""
|
238 |
|
239 |
|
240 |
|
|
|
241 |
# Generate the descriptive text using the model
|
242 |
-
result = table_to_text(prompt, max_length=200)[0]['generated_text']
|
243 |
|
244 |
return result
|
245 |
# 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:
|
215 |
|
216 |
Example for France (GDP):
|
217 |
Country: France
|
|
|
220 |
Adverse 2022: -1.195906
|
221 |
Adverse Cumulative: -3.573762
|
222 |
|
|
|
223 |
Summary:
|
224 |
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%.
|
225 |
|
226 |
+
Now summarize the following data for {theme} in {country}:
|
227 |
{row_str}
|
228 |
|
229 |
The theme is {theme}. For the data provided:
|
230 |
+
- Mention if the values have increased or decreased compared to previous years.
|
231 |
+
- Include the cumulative result if available.
|
232 |
+
- Follow the format in the example.
|
|
|
233 |
|
234 |
+
Ensure the summary reflects the changes in the values clearly.
|
235 |
"""
|
236 |
|
237 |
|
238 |
|
239 |
+
|
240 |
# Generate the descriptive text using the model
|
241 |
+
result = table_to_text(prompt, max_length=200, temperature=0.7, top_p=0.9)[0]['generated_text']
|
242 |
|
243 |
return result
|
244 |
# Global variable
|