Repository navigation
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (39 loc) · 1.75 KB
/
Copy pathapp.py
File metadata and controls
50 lines (39 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Data Forge - DeveloperOS Flagship Application
"""
import streamlit as st
import json
from core.data_generator import generate_synthetic_records
from ui.components import render_forge_header, render_forge_footer, render_main_promotional_banner
st.set_page_config(
page_title="Data Forge — DeveloperOS Flagship",
page_icon="🔨",
layout="wide"
)
def main():
render_forge_header()
st.subheader("Generate Synthetic Developer Datasets")
col_c, col_s = st.columns([1, 1])
with col_c:
record_count = st.slider("Record Count", min_value=5, max_value=250, value=25)
with col_s:
random_seed = st.number_input("Deterministic Random Seed", value=42)
format_choice = st.radio("Export Format", ["JSON Array", "SQL INSERT Statements", "CSV Format"], horizontal=True)
if st.button("Forge Dataset", type="primary"):
records = generate_synthetic_records(count=record_count, seed=int(random_seed))
if format_choice == "JSON Array":
st.code(json.dumps(records, indent=2), language="json")
elif format_choice == "SQL INSERT Statements":
sql_rows = []
for r in records:
sql_rows.append(f"INSERT INTO users (id, name, email, role, is_active) VALUES ({r['id']}, '{r['name']}', '{r['email']}', '{r['role']}', {r['is_active']});")
st.code("\n".join(sql_rows), language="sql")
else:
csv_lines = ["id,name,email,role,is_active"]
for r in records:
csv_lines.append(f"{r['id']},{r['name']},{r['email']},{r['role']},{r['is_active']}")
st.code("\n".join(csv_lines), language="text")
render_main_promotional_banner(tool_name="Data Forge")
render_forge_footer()
if __name__ == "__main__":
main()