Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -207,7 +207,6 @@ def generate_text(df, country, theme):
|
|
207 |
# Create a formatted string with colons and percentages
|
208 |
formatted_row = []
|
209 |
for col, value in row.items():
|
210 |
-
print(col)
|
211 |
if col != 'Country': # Exclude 'Country' or format differently if needed
|
212 |
if isinstance(value, (int, float)): # Add percentage sign for numeric values
|
213 |
value_str = f"{value:.6f}%"
|
@@ -221,7 +220,7 @@ def generate_text(df, country, theme):
|
|
221 |
row = df[df['Country'] == country].iloc[0]
|
222 |
row_str = format_row_for_prompt(row)
|
223 |
#row_str = row.to_string(index=True)
|
224 |
-
|
225 |
simple_prompt = f"""
|
226 |
Here is the data for {theme} in {country}:
|
227 |
{row_str}
|
@@ -274,7 +273,7 @@ def generate_text(df, country, theme):
|
|
274 |
|
275 |
|
276 |
# Generate the descriptive text using the model
|
277 |
-
result = table_to_text(prompt, max_length=200, temperature = 0.7, top_p = 0.9)[0]['generated_text']
|
278 |
|
279 |
return result
|
280 |
# Global variable
|
|
|
207 |
# Create a formatted string with colons and percentages
|
208 |
formatted_row = []
|
209 |
for col, value in row.items():
|
|
|
210 |
if col != 'Country': # Exclude 'Country' or format differently if needed
|
211 |
if isinstance(value, (int, float)): # Add percentage sign for numeric values
|
212 |
value_str = f"{value:.6f}%"
|
|
|
220 |
row = df[df['Country'] == country].iloc[0]
|
221 |
row_str = format_row_for_prompt(row)
|
222 |
#row_str = row.to_string(index=True)
|
223 |
+
print(row_str)
|
224 |
simple_prompt = f"""
|
225 |
Here is the data for {theme} in {country}:
|
226 |
{row_str}
|
|
|
273 |
|
274 |
|
275 |
# Generate the descriptive text using the model
|
276 |
+
result = table_to_text(prompt, max_length=200, temperature = 0.7, top_p = 0.9, do_sample=True)[0]['generated_text']
|
277 |
|
278 |
return result
|
279 |
# Global variable
|