Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,10 +22,10 @@ def create_portfolio_graph(amount):
|
|
| 22 |
|
| 23 |
return chart
|
| 24 |
|
| 25 |
-
def on_submit(
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
plot.
|
| 29 |
|
| 30 |
with gr.Blocks() as demo:
|
| 31 |
title = gr.Markdown(
|
|
@@ -34,8 +34,9 @@ with gr.Blocks() as demo:
|
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
total_funds_input = gr.Number(value=0)
|
|
|
|
| 37 |
plot = gr.Plot(label="Portfolio Composition Chart")
|
| 38 |
-
|
| 39 |
demo.load(create_portfolio_graph, inputs=[total_funds_input, button], outputs=[title, plot])
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
|
@@ -62,5 +63,6 @@ if __name__ == "__main__":
|
|
| 62 |
|
| 63 |
|
| 64 |
|
|
|
|
| 65 |
|
| 66 |
|
|
|
|
| 22 |
|
| 23 |
return chart
|
| 24 |
|
| 25 |
+
def on_submit():
|
| 26 |
+
# Callback function to handle button click
|
| 27 |
+
amount = total_funds_input.value
|
| 28 |
+
plot.change(create_portfolio_graph, inputs=[total_funds_input], outputs=[plot])
|
| 29 |
|
| 30 |
with gr.Blocks() as demo:
|
| 31 |
title = gr.Markdown(
|
|
|
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
total_funds_input = gr.Number(value=0)
|
| 37 |
+
button = gr.Button("Submit", click=on_submit)
|
| 38 |
plot = gr.Plot(label="Portfolio Composition Chart")
|
| 39 |
+
|
| 40 |
demo.load(create_portfolio_graph, inputs=[total_funds_input, button], outputs=[title, plot])
|
| 41 |
|
| 42 |
if __name__ == "__main__":
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
+
|
| 67 |
|
| 68 |
|