dan9423's picture
Create app.py
8fdb043 verified
Raw
History Blame Contribute Delete
805 Bytes
import gradio as gr
RESIDUES = {1, 7, 11, 13, 17, 19, 23, 29}
def reading_point(n):
n = int(n)
residue = n % 30
if residue in RESIDUES:
status = "Reduced residue class modulo 30"
detail = f"{n} mod 30 = {residue}, which is coprime to 30."
else:
status = "Outside the reduced residue classes"
detail = f"{n} mod 30 = {residue}, which shares a factor with 30."
return residue, status, detail
demo = gr.Interface(
fn=reading_point,
inputs=gr.Number(label="Integer", precision=0),
outputs=[
gr.Number(label="n mod 30"),
gr.Textbox(label="Reading"),
gr.Textbox(label="Specification"),
],
title="Modulo 30 Reading Point",
description="Explore the eight reduced residue classes modulo 30.",
)
demo.launch()