Spaces:
Runtime error
Runtime error
File size: 612 Bytes
291349f 9b3b8c8 291349f 0fc9213 291349f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
def gcd(a: int, b: int) -> int:
"""Compute the greatest common divisor of two integers."""
while b:
a, b = b, a % b
return abs(a)
gcd_interface = gr.Interface(
fn=gcd,
inputs=[gr.Number(label="A", precision=0), gr.Number(label="B", precision=0)],
outputs="number",
title="Greatest Common Divisor (GCD)",
description="Compute the greatest common divisor (GCD) of two integers using the Euclidean algorithm. The GCD is the largest integer that divides both numbers without leaving a remainder.",
examples=[[48, 18], [101, 10], [0, 5], [7, 7]],
)
|