Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,11 +3,6 @@ import altair as alt
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def create_portfolio_graph(amount):
|
| 6 |
-
try:
|
| 7 |
-
amount = float(amount)
|
| 8 |
-
except ValueError:
|
| 9 |
-
return None # Return None if the entered value is not numeric
|
| 10 |
-
|
| 11 |
# Calculate positions based on the provided amount
|
| 12 |
long_position = 0.9 * amount
|
| 13 |
short_position = 0.1 * amount
|
|
@@ -33,8 +28,8 @@ with gr.Blocks() as demo:
|
|
| 33 |
# This is the Current Recommended Portfolio Allocation
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
-
total_funds_input = gr.
|
| 37 |
-
submit_button = gr.Button("Submit")
|
| 38 |
|
| 39 |
plot = gr.Plot(label="Portfolio Composition Chart")
|
| 40 |
plot.change(create_portfolio_graph, inputs=[total_funds_input, submit_button], outputs=[plot])
|
|
@@ -63,5 +58,6 @@ if __name__ == "__main__":
|
|
| 63 |
|
| 64 |
|
| 65 |
|
|
|
|
| 66 |
|
| 67 |
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def create_portfolio_graph(amount):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Calculate positions based on the provided amount
|
| 7 |
long_position = 0.9 * amount
|
| 8 |
short_position = 0.1 * amount
|
|
|
|
| 28 |
# This is the Current Recommended Portfolio Allocation
|
| 29 |
"""
|
| 30 |
)
|
| 31 |
+
total_funds_input = gr.Number(value=0)
|
| 32 |
+
submit_button = gr.Button("Submit", elem_id="btn", elem_classes=["abc", "def"])
|
| 33 |
|
| 34 |
plot = gr.Plot(label="Portfolio Composition Chart")
|
| 35 |
plot.change(create_portfolio_graph, inputs=[total_funds_input, submit_button], outputs=[plot])
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
+
|
| 62 |
|
| 63 |
|