Spaces:
Sleeping
Sleeping
Diego Salinas commited on
yreyeyr
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import plotly.graph_objects as go
|
| 3 |
|
| 4 |
-
def plot_portfolio(
|
| 5 |
# Create a bar graph
|
| 6 |
fig = go.Figure()
|
| 7 |
|
| 8 |
# Add bars for long and short
|
| 9 |
-
fig.add_trace(go.Bar(x=['Long', 'Short'], y=[
|
| 10 |
marker_color=['blue', 'red']))
|
| 11 |
|
| 12 |
# Update layout for better presentation
|
|
@@ -29,14 +29,13 @@ def plot_portfolio(long_percentage, short_percentage):
|
|
| 29 |
# Define the Gradio interface
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=plot_portfolio,
|
| 32 |
-
inputs=[gr.Slider(0, 100, label='Long (%)'),
|
| 33 |
-
gr.Slider(0, 100, label='Short (%)')],
|
| 34 |
outputs=[gr.Image()],
|
| 35 |
live=True,
|
| 36 |
)
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
iface.launch(
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import plotly.graph_objects as go
|
| 3 |
|
| 4 |
+
def plot_portfolio():
|
| 5 |
# Create a bar graph
|
| 6 |
fig = go.Figure()
|
| 7 |
|
| 8 |
# Add bars for long and short
|
| 9 |
+
fig.add_trace(go.Bar(x=['Long', 'Short'], y=[90, 10],
|
| 10 |
marker_color=['blue', 'red']))
|
| 11 |
|
| 12 |
# Update layout for better presentation
|
|
|
|
| 29 |
# Define the Gradio interface
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=plot_portfolio,
|
|
|
|
|
|
|
| 32 |
outputs=[gr.Image()],
|
| 33 |
live=True,
|
| 34 |
)
|
| 35 |
|
| 36 |
+
# Launch the Gradio interface
|
| 37 |
+
iface.launch()
|
| 38 |
+
|
| 39 |
|
| 40 |
|
| 41 |
|