Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -199,9 +199,9 @@ def process_pdfs_and_analyze_sentiment(file1, file2, sheet):
|
|
199 |
|
200 |
def generate_text(df, country, theme):
|
201 |
# Filter the dataframe based on the country
|
202 |
-
for column in df.columns:
|
203 |
-
|
204 |
-
|
205 |
row = df[df['Country'] == country].iloc[0]
|
206 |
|
207 |
# Convert the row to a string format for prompt
|
@@ -218,10 +218,10 @@ def generate_text(df, country, theme):
|
|
218 |
|
219 |
Example 1 (Australia - GDP):
|
220 |
Country: Australia
|
221 |
-
Adverse 2020: -0.427975
|
222 |
-
Adverse 2021: -1.987167
|
223 |
-
Adverse 2022: -1.195906
|
224 |
-
Adverse Cumulative: -3.573762
|
225 |
The topic is GDP.
|
226 |
|
227 |
Summary:
|
@@ -229,16 +229,18 @@ def generate_text(df, country, theme):
|
|
229 |
|
230 |
Example 2 (Poland - HICP):
|
231 |
Country: Poland
|
232 |
-
Adverse 2023: 17.656378
|
233 |
-
Adverse 2024: 8.188389
|
234 |
-
Adverse 2025: 4.321625
|
235 |
-
Adverse Cumulative: 32.79156
|
236 |
The topic is HICP.
|
237 |
|
238 |
Summary:
|
239 |
In the adverse scenario, the HICP rate in Poland was 17.656378% in 2023, decreased to 8.188389% in 2024, and continued to decrease to 4.321625% in 2025. The cumulative adverse HICP rate over the period is 32.79156%.
|
240 |
|
241 |
Now, use the following data for {theme} in {country} to generate a similar summary:
|
|
|
|
|
242 |
{row_str}
|
243 |
|
244 |
The topic is {theme}. Summarize the data, ensuring that the summary reflects the theme accurately. Follow the pattern of the examples provided and describe any changes in values using terms like 'increase' and 'decrease'. Make sure the output aligns with the data.
|
|
|
199 |
|
200 |
def generate_text(df, country, theme):
|
201 |
# Filter the dataframe based on the country
|
202 |
+
#for column in df.columns:
|
203 |
+
# if column != 'Country':
|
204 |
+
# df[column] = df[column].apply(lambda x: f"{x:.6f}%")
|
205 |
row = df[df['Country'] == country].iloc[0]
|
206 |
|
207 |
# Convert the row to a string format for prompt
|
|
|
218 |
|
219 |
Example 1 (Australia - GDP):
|
220 |
Country: Australia
|
221 |
+
Adverse 2020: -0.427975
|
222 |
+
Adverse 2021: -1.987167
|
223 |
+
Adverse 2022: -1.195906
|
224 |
+
Adverse Cumulative: -3.573762
|
225 |
The topic is GDP.
|
226 |
|
227 |
Summary:
|
|
|
229 |
|
230 |
Example 2 (Poland - HICP):
|
231 |
Country: Poland
|
232 |
+
Adverse 2023: 17.656378
|
233 |
+
Adverse 2024: 8.188389
|
234 |
+
Adverse 2025: 4.321625
|
235 |
+
Adverse Cumulative: 32.79156
|
236 |
The topic is HICP.
|
237 |
|
238 |
Summary:
|
239 |
In the adverse scenario, the HICP rate in Poland was 17.656378% in 2023, decreased to 8.188389% in 2024, and continued to decrease to 4.321625% in 2025. The cumulative adverse HICP rate over the period is 32.79156%.
|
240 |
|
241 |
Now, use the following data for {theme} in {country} to generate a similar summary:
|
242 |
+
|
243 |
+
Example 3 ({country} - {theme}):
|
244 |
{row_str}
|
245 |
|
246 |
The topic is {theme}. Summarize the data, ensuring that the summary reflects the theme accurately. Follow the pattern of the examples provided and describe any changes in values using terms like 'increase' and 'decrease'. Make sure the output aligns with the data.
|