Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def register_study(title, domain, sphere, pi):
|
| 4 |
+
study_id = f"STU-{hash(title) % 10000:04d}"
|
| 5 |
+
result = f"Study ID: {study_id}\nTitle: {title}\nDomain: {domain}\nSphere: {sphere}\nPI: {pi}\nStatus: registered\nDate: 2026-05-11"
|
| 6 |
+
return result
|
| 7 |
+
|
| 8 |
+
with gr.Blocks(title="studyreg") as demo:
|
| 9 |
+
gr.Markdown("# Study Registry — Pre-register Your Study")
|
| 10 |
+
title = gr.Textbox(label="Study Title")
|
| 11 |
+
domain = gr.Dropdown(["biomedical","ml","climate","agriculture","economics","other"], label="Domain")
|
| 12 |
+
sphere = gr.Dropdown(["Science","Entrepreneurship","Technology"], label="SET Sphere")
|
| 13 |
+
pi = gr.Textbox(label="Principal Investigator")
|
| 14 |
+
out = gr.Textbox(label="Registration Result")
|
| 15 |
+
btn = gr.Button("Register Study")
|
| 16 |
+
btn.click(register_study, [title, domain, sphere, pi], out)
|
| 17 |
+
|
| 18 |
+
demo.launch()
|