Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,9 @@ import pandas as pd
|
|
20 |
display_ticker = []
|
21 |
moneycontrol_news = ""
|
22 |
earning_stocks = ""
|
|
|
|
|
|
|
23 |
|
24 |
# https://www.bing.com/news/search?q=linde+india&FORM=HDRSC7
|
25 |
client = InferenceClient(
|
@@ -38,36 +41,6 @@ def get_part_of_day(h):
|
|
38 |
)
|
39 |
|
40 |
|
41 |
-
# To use current hour:
|
42 |
-
part = get_part_of_day(datetime.datetime.now().hour)
|
43 |
-
greet = f"Good {part}!"
|
44 |
-
|
45 |
-
PLACEHOLDER = f"""
|
46 |
-
<div class="message-bubble-border" style="display:flex; max-width: 600px; border-width: 1px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
|
47 |
-
<figure style="margin: 0;">
|
48 |
-
<img src="https://i.pinimg.com/originals/02/55/6a/02556a88bdc3d4e89787be346c6faa00.jpg" alt="Logo" style="width: 100%; height: 100%; border-radius: 8px;">
|
49 |
-
</figure>
|
50 |
-
<div style="padding: .5rem 1.5rem;">
|
51 |
-
<h2 style="text-align: left; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;">Hi, {greet} </h2>
|
52 |
-
<p style="text-align: left; font-size: 16px; line-height: 1.5; margin-bottom: 15px;">This space lets you chat with an agent which can fetch real-time stock updates and market news using top expert sites and Mixtral.</p>
|
53 |
-
<div style="display: flex; justify-content: space-between; align-items: center;">
|
54 |
-
<div style="display: flex; flex-flow: column; justify-content: space-between;">
|
55 |
-
<span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
|
56 |
-
Mistral 7B Instruct v0.3
|
57 |
-
</span>
|
58 |
-
</div>
|
59 |
-
<div style="display: flex; justify-content: flex-end; align-items: center;">
|
60 |
-
<a href="https://in.linkedin.com/in/sharad-deep-shukla" target="_blank" rel="noreferrer" style="padding: .5rem;">
|
61 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
62 |
-
<title>LinkedIn</title>
|
63 |
-
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.85-3.037-1.851 0-2.135 1.445-2.135 2.935v5.671h-3.554v-11.5h3.413v1.571h.048c.475-.899 1.637-1.85 3.368-1.85 3.601 0 4.268 2.369 4.268 5.451v6.328zm-14.454-13.497c-1.145 0-2.072-.928-2.072-2.073 0-1.145.928-2.073 2.072-2.073 1.145 0 2.073.928 2.073 2.073-.001 1.145-.928 2.073-2.073 2.073zm1.777 13.497h-3.554v-11.5h3.554v11.5zm15.23-24h-18.141c-1.423 0-2.583 1.16-2.583 2.583v18.833c0 1.423 1.16 2.583 2.583 2.583h18.141c1.422 0 2.583-1.16 2.583-2.583v-18.833c-.001-1.423-1.161-2.583-2.584-2.583z"/>
|
64 |
-
</svg>
|
65 |
-
</a>
|
66 |
-
</div>
|
67 |
-
</div>
|
68 |
-
</div>
|
69 |
-
</div>
|
70 |
-
"""
|
71 |
|
72 |
def latest_earning():
|
73 |
earning_link=[]
|
@@ -177,6 +150,7 @@ def get_moneycontrol_news():
|
|
177 |
def job():
|
178 |
moneycontrol_news = get_moneycontrol_news()
|
179 |
earning_stocks = latest_earning()
|
|
|
180 |
|
181 |
# Schedule the job every 60 minutes
|
182 |
schedule.every(1).hours.do(job)
|
@@ -190,6 +164,35 @@ def run_scheduler():
|
|
190 |
scheduler_thread = threading.Thread(target=run_scheduler)
|
191 |
scheduler_thread.start()
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
def get_the_ticker(stock_name):
|
194 |
if stock_name == []:
|
195 |
matches=[]
|
|
|
20 |
display_ticker = []
|
21 |
moneycontrol_news = ""
|
22 |
earning_stocks = ""
|
23 |
+
part = ""
|
24 |
+
|
25 |
+
print("currect hour:", (datetime.datetime.now().hour))
|
26 |
|
27 |
# https://www.bing.com/news/search?q=linde+india&FORM=HDRSC7
|
28 |
client = InferenceClient(
|
|
|
41 |
)
|
42 |
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
def latest_earning():
|
46 |
earning_link=[]
|
|
|
150 |
def job():
|
151 |
moneycontrol_news = get_moneycontrol_news()
|
152 |
earning_stocks = latest_earning()
|
153 |
+
part = get_part_of_day(datetime.datetime.now().hour)
|
154 |
|
155 |
# Schedule the job every 60 minutes
|
156 |
schedule.every(1).hours.do(job)
|
|
|
164 |
scheduler_thread = threading.Thread(target=run_scheduler)
|
165 |
scheduler_thread.start()
|
166 |
|
167 |
+
greet = f"Good {part}!"
|
168 |
+
|
169 |
+
PLACEHOLDER = f"""
|
170 |
+
<div class="message-bubble-border" style="display:flex; max-width: 600px; border-width: 1px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
|
171 |
+
<figure style="margin: 0;">
|
172 |
+
<img src="https://i.pinimg.com/originals/02/55/6a/02556a88bdc3d4e89787be346c6faa00.jpg" alt="Logo" style="width: 100%; height: 100%; border-radius: 8px;">
|
173 |
+
</figure>
|
174 |
+
<div style="padding: .5rem 1.5rem;">
|
175 |
+
<h2 style="text-align: left; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;">Hi, {greet} </h2>
|
176 |
+
<p style="text-align: left; font-size: 16px; line-height: 1.5; margin-bottom: 15px;">This space lets you chat with an agent which can fetch real-time stock updates and market news using top expert sites and Mixtral.</p>
|
177 |
+
<div style="display: flex; justify-content: space-between; align-items: center;">
|
178 |
+
<div style="display: flex; flex-flow: column; justify-content: space-between;">
|
179 |
+
<span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
|
180 |
+
Mistral 7B Instruct v0.3
|
181 |
+
</span>
|
182 |
+
</div>
|
183 |
+
<div style="display: flex; justify-content: flex-end; align-items: center;">
|
184 |
+
<a href="https://in.linkedin.com/in/sharad-deep-shukla" target="_blank" rel="noreferrer" style="padding: .5rem;">
|
185 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
186 |
+
<title>LinkedIn</title>
|
187 |
+
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.85-3.037-1.851 0-2.135 1.445-2.135 2.935v5.671h-3.554v-11.5h3.413v1.571h.048c.475-.899 1.637-1.85 3.368-1.85 3.601 0 4.268 2.369 4.268 5.451v6.328zm-14.454-13.497c-1.145 0-2.072-.928-2.072-2.073 0-1.145.928-2.073 2.072-2.073 1.145 0 2.073.928 2.073 2.073-.001 1.145-.928 2.073-2.073 2.073zm1.777 13.497h-3.554v-11.5h3.554v11.5zm15.23-24h-18.141c-1.423 0-2.583 1.16-2.583 2.583v18.833c0 1.423 1.16 2.583 2.583 2.583h18.141c1.422 0 2.583-1.16 2.583-2.583v-18.833c-.001-1.423-1.161-2.583-2.584-2.583z"/>
|
188 |
+
</svg>
|
189 |
+
</a>
|
190 |
+
</div>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
"""
|
195 |
+
|
196 |
def get_the_ticker(stock_name):
|
197 |
if stock_name == []:
|
198 |
matches=[]
|