Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ pipe = pipeline(
|
|
| 16 |
"text-generation",
|
| 17 |
model=model_name,
|
| 18 |
tokenizer=model_name,
|
| 19 |
-
max_new_tokens=
|
| 20 |
temperature=0.0,
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=6,
|
|
@@ -28,23 +28,55 @@ pipe = pipeline(
|
|
| 28 |
# Prompt template
|
| 29 |
prompt_template = """
|
| 30 |
You are a financial market analyst.
|
| 31 |
-
Before making a prediction, you
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
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.
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
-
-
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
{context}
|
| 49 |
|
| 50 |
Question:
|
|
|
|
| 16 |
"text-generation",
|
| 17 |
model=model_name,
|
| 18 |
tokenizer=model_name,
|
| 19 |
+
max_new_tokens=600,
|
| 20 |
temperature=0.0,
|
| 21 |
do_sample=False,
|
| 22 |
num_beams=6,
|
|
|
|
| 28 |
# Prompt template
|
| 29 |
prompt_template = """
|
| 30 |
You are a financial market analyst.
|
| 31 |
+
Before making a prediction, you must analyze the past, provided in the Context below.
|
| 32 |
|
| 33 |
+
Your goal is to identify similar historical situations and use them to infer what may happen next.
|
| 34 |
+
Your analysis must be comprehensive, covering macroeconomic, sectoral, and corporate-specific factors.
|
| 35 |
|
| 36 |
+
When analyzing the Context, consider:
|
|
|
|
| 37 |
|
| 38 |
+
Macroeconomic indicators: interest rate trends, inflation, GDP growth, employment data, central bank policy, commodity prices, and currency movements.
|
| 39 |
|
| 40 |
+
Geopolitical factors: wars, sanctions, trade tensions, energy crises, and political instability.
|
| 41 |
|
| 42 |
+
Sector performance: sector rotations, capital inflows/outflows, relative strength of industries.
|
| 43 |
|
| 44 |
+
Corporate-level factors:
|
| 45 |
|
| 46 |
+
Cross-shareholdings, mergers & acquisitions, and strategic investments between companies.
|
| 47 |
+
|
| 48 |
+
Earnings reports, profit warnings, and guidance revisions.
|
| 49 |
+
|
| 50 |
+
Dividend policies, share buybacks, and debt restructuring.
|
| 51 |
+
|
| 52 |
+
Insider trading, institutional buying/selling, and large fund movements.
|
| 53 |
+
|
| 54 |
+
Technological innovation, regulation changes, and supply chain disruptions.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
Historical Approach
|
| 58 |
+
|
| 59 |
+
Identify past periods that closely resemble the current environment (e.g., "high inflation + geopolitical conflict" or "rate hikes + tech earnings slump").
|
| 60 |
+
|
| 61 |
+
Base your reasoning on actual market reactions from those periods — specify which companies or sectors moved and how.
|
| 62 |
+
|
| 63 |
+
If multiple scenarios are possible, explain each one and why the market may react differently under varying conditions.
|
| 64 |
+
|
| 65 |
+
Explicitly name the historical reference period(s) used (e.g., "2008 financial crisis," "2020 pandemic crash and recovery," etc.).
|
| 66 |
+
|
| 67 |
+
Response Format
|
| 68 |
+
|
| 69 |
+
Chosen Stock or List of Stocks:
|
| 70 |
+
(name/names)
|
| 71 |
+
|
| 72 |
+
Prediction(s):
|
| 73 |
+
(expected price change or direction)
|
| 74 |
+
|
| 75 |
+
Explanation:
|
| 76 |
+
A concise, factual analysis linking the historical precedent to the current conditions.
|
| 77 |
+
Mention the relevant macroeconomic, sector, and corporate factors, explaining how they interacted in the past and why similar outcomes may occur again. "
|
| 78 |
+
|
| 79 |
+
Here the Context:
|
| 80 |
{context}
|
| 81 |
|
| 82 |
Question:
|