{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "1b962101", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7860\n", "Running on public URL: https://8976dd303c781f1f0e.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import gradio as gr\n", "\n", "def esfera(raio,calculo):\n", " if (calculo==\"perimetro\"):\n", " return 2*raio*3.14\n", "\n", " if (calculo==\"area\"):\n", " return 3.14*raio**2\n", "\n", "iface = gr.Interface(fn=esfera,\n", " inputs=[gr.Slider(1, 20,1),\n", " gr.Dropdown([\"perimetro\", \"area\"])], outputs=\"number\")\n", "iface.launch(debug=True, share=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "0a6f6d0a", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" } }, "nbformat": 4, "nbformat_minor": 5 }