Spaces:
Runtime error
Runtime error
import gradio as gr | |
def odometer_principle(digit, base): | |
digit_class = int(digit) | |
base_class = int(base) | |
if digit_class < 0 or base_class < 2: | |
return "Invalid Input" | |
digitStr = str(digit_class) | |
strLen = len(digitStr) | |
randomVar = 1 | |
while True: | |
if strLen - randomVar < 0: | |
digit_class = int('1' + digitStr) | |
return f"The next value is {digit_class}" | |
else: | |
a = digitStr[strLen - randomVar] | |
if int(a) != base_class - 1: | |
digit_class = int(digitStr[:strLen - randomVar] + str(int(a) + 1) + digitStr[strLen - randomVar + 1:]) | |
return f"The next value is {digit_class}" | |
else: | |
digitStr = digitStr[:strLen - randomVar] + '0' + digitStr[strLen - randomVar + 1:] | |
randomVar += 1 | |
iface = gr.Interface(fn=odometer_principle, inputs=["text", "text"], outputs=["text"]) | |
iface.launch() |