Spaces:
Runtime error
Runtime error
Commit History
-
Update app.py
Verified signatureimport gradio as gr def calculator(a, b, operation): try: a = float(a) b = float(b) if operation == "Add": return a + b elif operation == "Subtract": return a - b elif operation == "Multiply": return a * b elif operation == "Divide": if b != 0: return a / b else: return "Error: Division by zero" else: return "Invalid operation" except ValueError: return "Error: Invalid input" # Gradio Interface dropdown = gr.Dropdown(["Add", "Subtract", "Multiply", "Divide"], label="Operation") num1 = gr.Textbox(label="Enter first number", type="number") num2 = gr.Textbox(label="Enter second number", type="number") iface = gr.Interface( fn=calculator, inputs=[num1, num2, dropdown], outputs="text", title="Simple Calculator", description="Perform basic arithmetic operations. Enter two numbers and select an op…3627b64 -
Update app.py
Verified signatureimport gradio as gr def calculator(a, b, operation): try: a = float(a) b = float(b) if operation == "Add": return a + b elif operation == "Subtract": return a - b elif operation == "Multiply": return a * b elif operation == "Divide": if b != 0: return a / b else: return "Error: Division by zero" else: return "Invalid operation" except ValueError: return "Error: Invalid input" # Gradio Interface dropdown = gr.inputs.Dropdown(["Add", "Subtract", "Multiply", "Divide"], label="Operation") num1 = gr.inputs.Textbox(label="Enter first number") num2 = gr.inputs.Textbox(label="Enter second number") iface = gr.Interface( fn=calculator, inputs=[num1, num2, dropdown], outputs="text", title="Simple Calculator", description="Perform basic arithmetic operations. Enter two numbers and select an operation."…f93b160 -
Create app.py
Verified signatureimport gradio as gr def greet(name): return f"Hello, {name}!" interface = gr.Interface(fn=greet, inputs="text", outputs="text") interface.launch()fb26b27