Spaces:
Runtime error
Runtime error
| """ | |
| Solve the equation ax = b for x. | |
| """ | |
| import gradio as gr | |
| def solve_linear_equation(a, b): | |
| if a == 0: | |
| if b == 0: | |
| return "Infinite solutions" | |
| return "No solution" | |
| return b / a | |
| solve_linear_equation_interface = gr.Interface( | |
| fn=solve_linear_equation, | |
| inputs=[ | |
| gr.Number(label="Coefficient (a)"), | |
| gr.Number(label="Constant (b)") | |
| ], | |
| outputs="text", | |
| title="Linear Equation Solver", | |
| description="Solve the equation ax = b for x" | |
| ) | |
| if __name__ == "__main__": | |
| solve_linear_equation_interface.launch() | |