| import gradio as gr | |
| def calculator(num1, operation, num2): | |
| if operation == "add": | |
| return num1 + num2 | |
| elif operation == "subtract": | |
| return num1 - num2 | |
| elif operation == "multiply": | |
| return num1 * num2 | |
| elif operation == "divide": | |
| return num1 / num2 | |
| def sampler(body, bottomwear, hair, topwear): | |
| img_name = str(body) + str(bottomwear) + str(hair) + str(topwear) | |
| return img_name | |
| demo = gr.Interface( | |
| calculator, | |
| ["number", gr.Radio(["add", "subtract", "multiply", "divide"]), "number"], | |
| "number", | |
| live=True, | |
| ) | |
| demo.launch() | |
| demo2 = gr.Interface( | |
| sampler, | |
| [gr.Radio(["body", "bottomwear", "hair", "topwear"])], | |
| live=True, | |
| ) | |
| demo2.launch() | |