| import gradio as gr | |
| def register_study(title, domain, sphere, pi): | |
| study_id = f"STU-{hash(title) % 10000:04d}" | |
| result = f"Study ID: {study_id}\nTitle: {title}\nDomain: {domain}\nSphere: {sphere}\nPI: {pi}\nStatus: registered\nDate: 2026-05-11" | |
| return result | |
| with gr.Blocks(title="studyreg") as demo: | |
| gr.Markdown("# Study Registry — Pre-register Your Study") | |
| title = gr.Textbox(label="Study Title") | |
| domain = gr.Dropdown(["biomedical","ml","climate","agriculture","economics","other"], label="Domain") | |
| sphere = gr.Dropdown(["Science","Entrepreneurship","Technology"], label="SET Sphere") | |
| pi = gr.Textbox(label="Principal Investigator") | |
| out = gr.Textbox(label="Registration Result") | |
| btn = gr.Button("Register Study") | |
| btn.click(register_study, [title, domain, sphere, pi], out) | |
| demo.launch() | |