| import gradio as gr | |
| def calculate(expr): | |
| try: | |
| return str(eval(expr)) | |
| except: | |
| return "Error" | |
| demo = gr.Interface( | |
| fn=calculate, | |
| inputs="text", | |
| outputs="text", | |
| title="Gradio Calculator" | |
| ) | |
| demo.launch() |
| import gradio as gr | |
| def calculate(expr): | |
| try: | |
| return str(eval(expr)) | |
| except: | |
| return "Error" | |
| demo = gr.Interface( | |
| fn=calculate, | |
| inputs="text", | |
| outputs="text", | |
| title="Gradio Calculator" | |
| ) | |
| demo.launch() |