SelmaNajih001 commited on
Commit
54065df
·
verified ·
1 Parent(s): 9fa187a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -11
app.py CHANGED
@@ -16,7 +16,7 @@ pipe = pipeline(
16
  "text-generation",
17
  model=model_name,
18
  tokenizer=model_name,
19
- max_new_tokens=250,
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 always analyze the past, which is provided in the Context below.
32
 
33
- 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).
34
- Base your reasoning on what actually happened during that specific timeframe.
35
 
36
- If, in the past, a given event caused changes in multiple stocks, provide a list of those stocks along with their price movements.
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
- Please respond with:
40
 
41
- -Chosen Stock or List of Stocks: (name/names)
42
 
43
- -Prediction(s): (expected price change)
44
 
45
- -Explanation: (brief, clear, and based on past patterns — mention the time period and the factors influencing the outcome)
46
 
47
- Context:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: