Spaces:
Runtime error
Runtime error
import gradio as gr | |
# Initial values | |
COINS = 2710 | |
MAX_BAG = 5800 | |
MAX_BOX = 6800 | |
CUR_BAG = 5400 | |
CUR_BOX = 6800 | |
def compute_days(coins, max_bag, max_box, cur_bag, cur_box): | |
# Solve for days | |
days = (max_bag + max_box - cur_bag - cur_box) / 50 * 4 | |
days = days - (coins / 50) | |
days_needed = int(days) | |
return max(0, days_needed), max(0, days_needed * 50) | |
# Define the input components | |
coin_input = gr.inputs.Number(label="Number of Coins", default=COINS) | |
max_bag_input = gr.inputs.Number(label="MAX_BAG", default=MAX_BAG) | |
max_box_input = gr.inputs.Number(label="MAX_BOX", default=MAX_BOX) | |
cur_bag_input = gr.inputs.Number(label="CUR_BAG", default=CUR_BAG) | |
cur_box_input = gr.inputs.Number(label="CUR_BOX", default=CUR_BOX) | |
# Create the interface | |
iface = gr.Interface( | |
fn=compute_days, | |
inputs=[coin_input, max_bag_input, max_box_input, cur_bag_input, cur_box_input], | |
outputs=[gr.outputs.Textbox(label="Days Needed"), gr.outputs.Textbox(label="Coins Needed")], | |
title="Pokemon GO Calculator", | |
description="Calculate the number of days needed to max out your Pokemon GO account - Here We Go!", | |
theme='xiaobaiyuan/theme_brief', | |
) | |
# Run the interface | |
iface.launch() |