Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,6 @@ summarizer = pipeline("summarization", model="human-centered-summarization/finan
|
|
26 |
fin_model = pipeline("sentiment-analysis", model='yiyanghkust/finbert-tone', tokenizer='yiyanghkust/finbert-tone')
|
27 |
fin_model_bis = pipeline("sentiment-analysis", model='ProsusAI/finbert', tokenizer='ProsusAI/finbert')
|
28 |
table_to_text = pipeline('text2text-generation', model='google/flan-t5-large')
|
29 |
-
generator = pipeline('text-generation', model='mattshumer/Reflection-Llama-3.1-70B')
|
30 |
|
31 |
def summarize_text(text):
|
32 |
resp = summarizer(text)
|
@@ -271,37 +270,6 @@ def generate_text(df, country, theme):
|
|
271 |
Make sure your description follows the example format and accurately reflects the data.
|
272 |
"""
|
273 |
|
274 |
-
prompt = f"""
|
275 |
-
<thinking>
|
276 |
-
You are given data on adverse growth for a specific country and topic. Your task is to describe the data in a clear and accurate manner, following the example provided. Reflect on how the values change from year to year, and analyze whether there is an increase or decrease compared to previous years. Consider if these changes indicate a worsening or improvement and specify if the change is strong or slight. Include the cumulative result and ensure your description aligns with the given example format.
|
277 |
-
</thinking>
|
278 |
-
|
279 |
-
<output>
|
280 |
-
Here is an example of how to describe adverse growth data for a given country:
|
281 |
-
|
282 |
-
Country: Australia
|
283 |
-
Adverse 2020: -0.43%
|
284 |
-
Adverse 2021: -1.99%
|
285 |
-
Adverse 2022: -1.20%
|
286 |
-
Adverse Cumulative: -3.57%
|
287 |
-
Topic: GDP
|
288 |
-
|
289 |
-
Description:
|
290 |
-
In the adverse scenario, the GDP growth in Australia was -0.43% in 2020. It decreased further to -1.99% in 2021, showing worsening conditions. However, there was a slight improvement to -1.20% in 2022. The total cumulative adverse growth is -3.57%.
|
291 |
-
|
292 |
-
Now, using the following data for {theme} in {country}, perform the following:
|
293 |
-
1. Highlight how the values change from year to year.
|
294 |
-
2. Describe whether the values increased or decreased compared to the previous year.
|
295 |
-
3. Indicate if the changes represent a worsening or improvement, and if this is strong or slight.
|
296 |
-
4. Include the cumulative result.
|
297 |
-
|
298 |
-
Data:
|
299 |
-
{row_str}
|
300 |
-
Topic: {theme}
|
301 |
-
Make sure your description follows the example format and accurately reflects the data.
|
302 |
-
</output>
|
303 |
-
"""
|
304 |
-
|
305 |
# Generate the descriptive text using the model
|
306 |
result = table_to_text(prompt, max_length=248)[0]['generated_text']
|
307 |
|
|
|
26 |
fin_model = pipeline("sentiment-analysis", model='yiyanghkust/finbert-tone', tokenizer='yiyanghkust/finbert-tone')
|
27 |
fin_model_bis = pipeline("sentiment-analysis", model='ProsusAI/finbert', tokenizer='ProsusAI/finbert')
|
28 |
table_to_text = pipeline('text2text-generation', model='google/flan-t5-large')
|
|
|
29 |
|
30 |
def summarize_text(text):
|
31 |
resp = summarizer(text)
|
|
|
270 |
Make sure your description follows the example format and accurately reflects the data.
|
271 |
"""
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
# Generate the descriptive text using the model
|
274 |
result = table_to_text(prompt, max_length=248)[0]['generated_text']
|
275 |
|