Update app.py
Browse files
app.py
CHANGED
|
@@ -21,27 +21,26 @@ pipe = pipeline(
|
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=4,
|
| 23 |
repetition_penalty=1.5,
|
| 24 |
-
return_full_text=False
|
|
|
|
| 25 |
)
|
| 26 |
|
| 27 |
# Prompt template
|
| 28 |
prompt_template = """
|
| 29 |
You are a financial market analyst.
|
| 30 |
Before making a prediction, you always analyze the past, which is provided in the Context below.
|
| 31 |
-
|
| 32 |
-
|
| 33 |
Base your reasoning on what actually happened during that specific timeframe.
|
| 34 |
|
| 35 |
-
If, in the past, multiple stocks have changed, provide a list of those stocks along with their price changes.
|
| 36 |
-
If a specific event led to different stock price reactions under varying circumstances
|
|
|
|
| 37 |
|
| 38 |
Please respond with:
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
Prediction(s): (expected price change)
|
| 43 |
-
|
| 44 |
-
Explanation: (brief, clear, and based on past patterns — mention the time period and the factors influencing the outcome)
|
| 45 |
|
| 46 |
Context:
|
| 47 |
{context}
|
|
@@ -82,7 +81,8 @@ examples = [
|
|
| 82 |
"Trump imposes tariffs",
|
| 83 |
"Tesla announces a new affordable electric vehicle model",
|
| 84 |
"Nvidia releases new GPU technology",
|
| 85 |
-
"Apple launches Apple TV+ subscription service"
|
|
|
|
| 86 |
]
|
| 87 |
|
| 88 |
description_md = """
|
|
|
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=4,
|
| 23 |
repetition_penalty=1.5,
|
| 24 |
+
return_full_text=False,
|
| 25 |
+
eos_token_id=tokenizer.eos_token_id
|
| 26 |
)
|
| 27 |
|
| 28 |
# Prompt template
|
| 29 |
prompt_template = """
|
| 30 |
You are a financial market analyst.
|
| 31 |
Before making a prediction, you always analyze the past, which is provided in the Context below.
|
| 32 |
+
When analyzing the Context, pay close attention to the dates and the economic conditions of that period
|
| 33 |
+
(e.g., interest rate changes, inflation trends, sector performance, or geopolitical events).
|
| 34 |
Base your reasoning on what actually happened during that specific timeframe.
|
| 35 |
|
| 36 |
+
If, in the past, given an event, multiple stocks have changed, provide a list of those stocks along with their price changes.
|
| 37 |
+
If a specific event led to different stock price reactions under varying circumstances
|
| 38 |
+
(for example, depending on whether interest rates were rising or falling), describe each plausible scenario and explain the reasoning behind the reaction in each case.
|
| 39 |
|
| 40 |
Please respond with:
|
| 41 |
+
-Chosen Stock or list of Stocks: (name/names)
|
| 42 |
+
-Prediction(s): (expected price change)
|
| 43 |
+
-Explanation: (brief, clear, and based on past patterns — mention the time period and the factors influencing the outcome)
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
Context:
|
| 46 |
{context}
|
|
|
|
| 81 |
"Trump imposes tariffs",
|
| 82 |
"Tesla announces a new affordable electric vehicle model",
|
| 83 |
"Nvidia releases new GPU technology",
|
| 84 |
+
"Apple launches Apple TV+ subscription service",
|
| 85 |
+
"Elon Musk created a new political party against Trump"
|
| 86 |
]
|
| 87 |
|
| 88 |
description_md = """
|