Spaces:
Sleeping
Sleeping
import gradio as gr | |
import numpy as np | |
def calculate_tia(t1, a1, t2, a2): | |
try: | |
# حساب معدل الإفراغ k | |
k = np.log(a1 / a2) / (t2 - t1) | |
# حساب النشاط الابتدائي A₀ | |
a0 = a1 / np.exp(-k * t1) | |
# حساب النشاط التكاملي TIA | |
tia = a0 / k | |
result = f"**Results:**\n- A₀ = {a0:.2f} MBq\n- k = {k:.5f} per hour\n- TIA = {tia:.2f} MBq·h" | |
except: | |
result = "Error: Please enter valid numbers." | |
return result | |
with gr.Blocks() as demo: | |
gr.Markdown("# Lu-177 Dosimetry Tool\nEstimate Time-Integrated Activity (TIA) from Two SPECT Time Points using Mono-Exponential Modeling.") | |
with gr.Row(): | |
t1 = gr.Number(label="Time Point 1 (hours)", value=20) | |
a1 = gr.Number(label="Activity at t1 (MBq)", value=12) | |
with gr.Row(): | |
t2 = gr.Number(label="Time Point 2 (hours)", value=60) | |
a2 = gr.Number(label="Activity at t2 (MBq)", value=4) | |
button = gr.Button("Calculate TIA") | |
output = gr.Markdown() | |
button.click(fn=calculate_tia, inputs=[t1, a1, t2, a2], outputs=output) | |
demo.launch() | |