infinitymatter commited on
Commit
c44a220
Β·
verified Β·
1 Parent(s): b9a79a8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +33 -29
main.py CHANGED
@@ -1,29 +1,33 @@
1
- import argparse
2
- import pandas as pd
3
- from generate_schema import generate_schema
4
- from fetch_data import fetch_real_data
5
- from synthetic_generator import train_and_generate_synthetic
6
-
7
- def main():
8
- parser = argparse.ArgumentParser()
9
- parser.add_argument("--prompt", type=str, required=True, help="Describe the dataset you want")
10
- parser.add_argument("--domain", type=str, default="healthcare", help="Domain to fetch real data from (optional)")
11
- args = parser.parse_args()
12
-
13
- # Step 1: Generate schema using LLM
14
- schema = generate_schema(args.prompt)
15
- print(f"πŸ“Š Generated schema: {schema}")
16
-
17
- # Step 2: Fetch real data (optional)
18
- real_data = fetch_real_data(args.domain)
19
-
20
- # Step 3: Preprocess (if necessary)
21
- real_data = real_data[schema['columns']] # Match columns from schema
22
- print(f"βœ… Fetched real data with shape: {real_data.shape}")
23
-
24
- # Step 4: Train GAN and generate synthetic data
25
- output_path = f"outputs/synthetic_{args.domain}.csv"
26
- train_and_generate_synthetic(real_data, schema, output_path)
27
-
28
- if __name__ == "__main__":
29
- main()
 
 
 
 
 
1
+ import argparse
2
+ import pandas as pd
3
+ import streamlit as st
4
+ from generate_schema import generate_schema
5
+ from fetch_data import fetch_real_data
6
+ from synthetic_generator import train_and_generate_synthetic
7
+
8
+ def main():
9
+ parser = argparse.ArgumentParser()
10
+ parser.add_argument("--prompt", type=str, required=True, help="Describe the dataset you want")
11
+ parser.add_argument("--domain", type=str, default="healthcare", help="Domain to fetch real data from (optional)")
12
+ args = parser.parse_args()
13
+
14
+ # Retrieve API token from Streamlit secrets
15
+ hf_token = st.secrets["hf_token"]
16
+
17
+ # Step 1: Generate schema using LLM
18
+ schema = generate_schema(args.prompt, hf_token)
19
+ print(f"πŸ“Š Generated schema: {schema}")
20
+
21
+ # Step 2: Fetch real data (optional)
22
+ real_data = fetch_real_data(args.domain)
23
+
24
+ # Step 3: Preprocess (if necessary)
25
+ real_data = real_data[schema['columns']] # Match columns from schema
26
+ print(f"βœ… Fetched real data with shape: {real_data.shape}")
27
+
28
+ # Step 4: Train GAN and generate synthetic data
29
+ output_path = f"outputs/synthetic_{args.domain}.csv"
30
+ train_and_generate_synthetic(real_data, schema, output_path)
31
+
32
+ if __name__ == "__main__":
33
+ main()