Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -304,6 +304,7 @@ def generate_text(df, country, theme):
|
|
304 |
formatted_row.append(f"{col}: {value}")
|
305 |
return "\n".join(formatted_row)
|
306 |
# Convert the row to a string format for prompt
|
|
|
307 |
df.columns = ['Country', f'{year}', f'{year+1}', f'{year+2}', 'Cumulative']
|
308 |
row = df[df['Country'] == country].iloc[0]
|
309 |
row_str = format_row_for_prompt(row)
|
|
|
304 |
formatted_row.append(f"{col}: {value}")
|
305 |
return "\n".join(formatted_row)
|
306 |
# Convert the row to a string format for prompt
|
307 |
+
year = int(re.search(r'(\d{4})', df.columns[1]).group(1))
|
308 |
df.columns = ['Country', f'{year}', f'{year+1}', f'{year+2}', 'Cumulative']
|
309 |
row = df[df['Country'] == country].iloc[0]
|
310 |
row_str = format_row_for_prompt(row)
|