Diego Salinas commited on
Commit
bad42ce
·
verified ·
1 Parent(s): 931f1ff
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio as gr
2
  import plotly.graph_objects as go
3
 
4
- def plot_portfolio(long_percentage, short_percentage):
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=[long_percentage, short_percentage],
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
- # Set initial values using a lambda function
39
- iface.launch(lambda: [90, 10])
 
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