Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,10 @@ from datasets import load_dataset
|
|
5 |
from sklearn.model_selection import train_test_split
|
6 |
import subprocess
|
7 |
|
|
|
|
|
|
|
|
|
8 |
# Function to run commands
|
9 |
def run_command(command):
|
10 |
try:
|
@@ -74,6 +78,7 @@ def predict(*inputs):
|
|
74 |
def explore_data(row_number):
|
75 |
return df.iloc[row_number].to_dict()
|
76 |
|
|
|
77 |
# Gradio UI
|
78 |
with gr.Blocks() as demo:
|
79 |
gr.Markdown("# Hair Health Dataset Exploration")
|
@@ -93,6 +98,12 @@ with gr.Blocks() as demo:
|
|
93 |
# Unpack the dictionary values into a list of input components
|
94 |
submit_button.click(predict, inputs=list(input_components.values()), outputs=[output])
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
gr.Markdown("## Command Runner")
|
97 |
|
98 |
command_input = gr.Textbox(label="Enter Command")
|
@@ -101,6 +112,5 @@ with gr.Blocks() as demo:
|
|
101 |
run_button = gr.Button("Run Command")
|
102 |
run_button.click(run_command, inputs=command_input, outputs=command_output)
|
103 |
|
104 |
-
|
105 |
demo.launch()
|
106 |
|
|
|
5 |
from sklearn.model_selection import train_test_split
|
6 |
import subprocess
|
7 |
|
8 |
+
# Function to show value counts of 'Hair Loss'
|
9 |
+
def show_hair_loss_counts():
|
10 |
+
return df['Hair Loss'].value_counts().to_json() # Convert to JSON for display
|
11 |
+
|
12 |
# Function to run commands
|
13 |
def run_command(command):
|
14 |
try:
|
|
|
78 |
def explore_data(row_number):
|
79 |
return df.iloc[row_number].to_dict()
|
80 |
|
81 |
+
|
82 |
# Gradio UI
|
83 |
with gr.Blocks() as demo:
|
84 |
gr.Markdown("# Hair Health Dataset Exploration")
|
|
|
98 |
# Unpack the dictionary values into a list of input components
|
99 |
submit_button.click(predict, inputs=list(input_components.values()), outputs=[output])
|
100 |
|
101 |
+
gr.Markdown("## Hair Loss Value Counts")
|
102 |
+
|
103 |
+
value_counts_output = gr.JSON(label="Hair Loss Value Counts")
|
104 |
+
value_counts_button = gr.Button("Show Hair Loss Counts")
|
105 |
+
value_counts_button.click(show_hair_loss_counts, outputs=[value_counts_output])
|
106 |
+
|
107 |
gr.Markdown("## Command Runner")
|
108 |
|
109 |
command_input = gr.Textbox(label="Enter Command")
|
|
|
112 |
run_button = gr.Button("Run Command")
|
113 |
run_button.click(run_command, inputs=command_input, outputs=command_output)
|
114 |
|
|
|
115 |
demo.launch()
|
116 |
|