Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -132,7 +132,7 @@ class Investment_Simulator:
|
|
| 132 |
return f"Error: {e}"
|
| 133 |
|
| 134 |
def run_all(self, text):
|
| 135 |
-
response = self.process_input()
|
| 136 |
fig = self.plot_portfolio_value()
|
| 137 |
return response, fig
|
| 138 |
|
|
@@ -203,6 +203,8 @@ custom_css = """
|
|
| 203 |
}
|
| 204 |
"""
|
| 205 |
|
|
|
|
|
|
|
| 206 |
with gr.Blocks(css=custom_css) as demo:
|
| 207 |
active_section = gr.State("chat")
|
| 208 |
sidebar_open = gr.State(True)
|
|
@@ -246,14 +248,17 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 246 |
with Zeno_Investments:
|
| 247 |
gr.Markdown("## Live Investment Simulator (Practice £500) + Portfolio Tracker")
|
| 248 |
|
| 249 |
-
simulator = Investment_Simulator(
|
| 250 |
|
| 251 |
invest_input = gr.Textbox(label="Enter a command", placeholder="Try: Buy £100 of AAPL")
|
| 252 |
invest_output = gr.Textbox(label="Bot Response")
|
| 253 |
invest_chart = gr.Plot(label="Portfolio Value Over Time")
|
| 254 |
|
| 255 |
-
invest_input.submit(
|
| 256 |
-
|
|
|
|
|
|
|
|
|
|
| 257 |
|
| 258 |
Zeno_News = gr.Column(visible=False, elem_id="Stock and Market News")
|
| 259 |
with Zeno_News:
|
|
@@ -266,11 +271,11 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 266 |
|
| 267 |
fetch_button = gr.Button("Get News")
|
| 268 |
fetch_button.click(
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
)
|
| 273 |
-
|
| 274 |
|
| 275 |
def handle_first_input(msg):
|
| 276 |
return gr.update(visible=False), gr.update(visible=True), msg, []
|
|
|
|
| 132 |
return f"Error: {e}"
|
| 133 |
|
| 134 |
def run_all(self, text):
|
| 135 |
+
response = self.process_input(text)
|
| 136 |
fig = self.plot_portfolio_value()
|
| 137 |
return response, fig
|
| 138 |
|
|
|
|
| 203 |
}
|
| 204 |
"""
|
| 205 |
|
| 206 |
+
news = News()
|
| 207 |
+
|
| 208 |
with gr.Blocks(css=custom_css) as demo:
|
| 209 |
active_section = gr.State("chat")
|
| 210 |
sidebar_open = gr.State(True)
|
|
|
|
| 248 |
with Zeno_Investments:
|
| 249 |
gr.Markdown("## Live Investment Simulator (Practice £500) + Portfolio Tracker")
|
| 250 |
|
| 251 |
+
simulator = Investment_Simulator()
|
| 252 |
|
| 253 |
invest_input = gr.Textbox(label="Enter a command", placeholder="Try: Buy £100 of AAPL")
|
| 254 |
invest_output = gr.Textbox(label="Bot Response")
|
| 255 |
invest_chart = gr.Plot(label="Portfolio Value Over Time")
|
| 256 |
|
| 257 |
+
invest_input.submit(
|
| 258 |
+
simulator.run_all,
|
| 259 |
+
inputs=invest_input,
|
| 260 |
+
outputs=[invest_output, invest_chart]
|
| 261 |
+
)
|
| 262 |
|
| 263 |
Zeno_News = gr.Column(visible=False, elem_id="Stock and Market News")
|
| 264 |
with Zeno_News:
|
|
|
|
| 271 |
|
| 272 |
fetch_button = gr.Button("Get News")
|
| 273 |
fetch_button.click(
|
| 274 |
+
fn=news.get_news,
|
| 275 |
+
inputs=ticker_input,
|
| 276 |
+
outputs=news_output
|
| 277 |
)
|
| 278 |
+
|
| 279 |
|
| 280 |
def handle_first_input(msg):
|
| 281 |
return gr.update(visible=False), gr.update(visible=True), msg, []
|