Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ COMPANY_TICKERS = {
|
|
| 25 |
'Datadog': 'DDOG',
|
| 26 |
'Samsara': 'IOT',
|
| 27 |
'ServiceNow': 'NOW',
|
| 28 |
-
'ANSYS': '
|
| 29 |
'Salesforce Inc':'CRM',
|
| 30 |
'Snowflake': 'SNOW',
|
| 31 |
'Palo Alto': 'PANW',
|
|
@@ -99,6 +99,8 @@ def plot_indicator(data, company_name, ticker, indicator, market_cap):
|
|
| 99 |
def plot_indicators(company_names, indicator_types):
|
| 100 |
"""Plot the selected indicators for the selected companies."""
|
| 101 |
images = []
|
|
|
|
|
|
|
| 102 |
if len(company_names) > 1 and len(indicator_types) > 1:
|
| 103 |
return None, "You can only select one indicator when selecting multiple companies."
|
| 104 |
|
|
@@ -136,7 +138,7 @@ def launch_gradio_app():
|
|
| 136 |
return images, ""
|
| 137 |
|
| 138 |
with gr.Blocks() as demo:
|
| 139 |
-
company_checkboxgroup = gr.CheckboxGroup(choices=company_choices, label="Select Companies")
|
| 140 |
|
| 141 |
select_all_checkbox = gr.Checkbox(label="Select All Indicators", value=False, interactive=True)
|
| 142 |
indicator_types_checkboxgroup = gr.CheckboxGroup(choices=indicators, label="Select Technical Indicators")
|
|
|
|
| 25 |
'Datadog': 'DDOG',
|
| 26 |
'Samsara': 'IOT',
|
| 27 |
'ServiceNow': 'NOW',
|
| 28 |
+
'ANSYS': 'ANSS',
|
| 29 |
'Salesforce Inc':'CRM',
|
| 30 |
'Snowflake': 'SNOW',
|
| 31 |
'Palo Alto': 'PANW',
|
|
|
|
| 99 |
def plot_indicators(company_names, indicator_types):
|
| 100 |
"""Plot the selected indicators for the selected companies."""
|
| 101 |
images = []
|
| 102 |
+
if len(company_names) > 5:
|
| 103 |
+
return None, "You can select up to 5 companies at the same time."
|
| 104 |
if len(company_names) > 1 and len(indicator_types) > 1:
|
| 105 |
return None, "You can only select one indicator when selecting multiple companies."
|
| 106 |
|
|
|
|
| 138 |
return images, ""
|
| 139 |
|
| 140 |
with gr.Blocks() as demo:
|
| 141 |
+
company_checkboxgroup = gr.CheckboxGroup(choices=company_choices, label="Select Companies", max_choices=5)
|
| 142 |
|
| 143 |
select_all_checkbox = gr.Checkbox(label="Select All Indicators", value=False, interactive=True)
|
| 144 |
indicator_types_checkboxgroup = gr.CheckboxGroup(choices=indicators, label="Select Technical Indicators")
|