Spaces:
Runtime error
Runtime error
| from .gcd import gcd | |
| import gradio as gr | |
| def lcm(a: int, b: int) -> int: | |
| """Compute the least common multiple of two integers.""" | |
| if a == 0 or b == 0: | |
| return 0 | |
| return abs(a * b) // gcd(a, b) | |
| lcm_interface = gr.Interface( | |
| fn=lcm, | |
| inputs=[gr.Number(label="A", precision=0), gr.Number(label="B", precision=0)], | |
| outputs="number", | |
| title="Least Common Multiple (LCM)", | |
| description="Compute the least common multiple (LCM) of two integers. The LCM is the smallest positive integer that is a multiple of both numbers.", | |
| examples=[[4, 6], [21, 6], [0, 5], [7, 7]], | |
| ) | |