Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ pipe = pipeline(
|
|
| 17 |
model=model_name,
|
| 18 |
tokenizer=model_name,
|
| 19 |
max_new_tokens=250,
|
| 20 |
-
temperature=0.
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=4,
|
| 23 |
repetition_penalty=1.5,
|
|
@@ -27,18 +27,26 @@ pipe = pipeline(
|
|
| 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
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
Please respond with:
|
| 34 |
-
- Chosen Stock: (name)
|
| 35 |
-
- Prediction: (price change)
|
| 36 |
-
- Explanation: (brief and clear)
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
{context}
|
| 40 |
|
| 41 |
-
Question:
|
| 42 |
What could happen after: {question}
|
| 43 |
"""
|
| 44 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|
|
|
|
| 17 |
model=model_name,
|
| 18 |
tokenizer=model_name,
|
| 19 |
max_new_tokens=250,
|
| 20 |
+
temperature=0.0,
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=4,
|
| 23 |
repetition_penalty=1.5,
|
|
|
|
| 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 |
+
When analyzing the Context, pay close attention to the dates and the economic conditions of that period (e.g., interest rate changes, inflation trends, sector performance, or geopolitical events).
|
| 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 (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.
|
| 37 |
|
| 38 |
Please respond with:
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
Chosen Stock or Stocks: (name/names)
|
| 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}
|
| 48 |
|
| 49 |
+
Question:
|
| 50 |
What could happen after: {question}
|
| 51 |
"""
|
| 52 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|