Spaces:
Runtime error
Runtime error
RamAnanth1
commited on
Commit
•
48c3eab
1
Parent(s):
ff99bb4
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def generate_data(file, num_samples):
|
|
20 |
# Generate synthetic data
|
21 |
samples = rtf_model.sample(n_samples=num_samples)
|
22 |
|
23 |
-
return samples
|
24 |
|
25 |
def generate_relational_data(parent_file, child_file, join_on):
|
26 |
parent_df = pd.read_csv(parent_file.name)
|
@@ -68,7 +68,7 @@ def generate_relational_data(parent_file, child_file, join_on):
|
|
68 |
input_df=parent_samples.drop(join_on, axis=1),
|
69 |
gen_batch=5)
|
70 |
|
71 |
-
return parent_samples, child_samples, gr.update(visible = True)
|
72 |
|
73 |
|
74 |
with gr.Blocks() as demo:
|
@@ -101,15 +101,13 @@ with gr.Blocks() as demo:
|
|
101 |
with gr.Row():
|
102 |
#data_sample = gr.Dataframe(label = "Original Data")
|
103 |
data_output = gr.Dataframe(label = "Synthetic Data")
|
104 |
-
data_output_file = gr.File(label = "Synthetic Data File")
|
105 |
with gr.Row(visible = False) as child_sample:
|
106 |
data_output_child = gr.Dataframe(label = "Synthetic Data for Child Dataset")
|
107 |
-
data_output_file_child = gr.File(label = "Synthetic Data File for Child Dataset")
|
108 |
|
109 |
|
110 |
-
generate_data_btn.click(generate_data, inputs = [data_input_u,num_samples], outputs = [data_output
|
111 |
-
generate_data_btn_relational.click(generate_relational_data, inputs = [data_input_parent,data_input_child,join_on], outputs = [data_output, data_output_child, child_sample
|
112 |
-
examples = gr.Examples(examples=[['diabetes.arff',5], ["titanic.csv", 15]],inputs = [data_input_u,num_samples], outputs = [data_output
|
113 |
|
114 |
|
115 |
demo.launch()
|
|
|
20 |
# Generate synthetic data
|
21 |
samples = rtf_model.sample(n_samples=num_samples)
|
22 |
|
23 |
+
return samples
|
24 |
|
25 |
def generate_relational_data(parent_file, child_file, join_on):
|
26 |
parent_df = pd.read_csv(parent_file.name)
|
|
|
68 |
input_df=parent_samples.drop(join_on, axis=1),
|
69 |
gen_batch=5)
|
70 |
|
71 |
+
return parent_samples, child_samples, gr.update(visible = True)
|
72 |
|
73 |
|
74 |
with gr.Blocks() as demo:
|
|
|
101 |
with gr.Row():
|
102 |
#data_sample = gr.Dataframe(label = "Original Data")
|
103 |
data_output = gr.Dataframe(label = "Synthetic Data")
|
|
|
104 |
with gr.Row(visible = False) as child_sample:
|
105 |
data_output_child = gr.Dataframe(label = "Synthetic Data for Child Dataset")
|
|
|
106 |
|
107 |
|
108 |
+
generate_data_btn.click(generate_data, inputs = [data_input_u,num_samples], outputs = [data_output])
|
109 |
+
generate_data_btn_relational.click(generate_relational_data, inputs = [data_input_parent,data_input_child,join_on], outputs = [data_output, data_output_child, child_sample])
|
110 |
+
examples = gr.Examples(examples=[['diabetes.arff',5], ["titanic.csv", 15]],inputs = [data_input_u,num_samples], outputs = [data_output], cache_examples = True, fn = generate_data)
|
111 |
|
112 |
|
113 |
demo.launch()
|