Ubuntu commited on
Commit
21db029
·
1 Parent(s): fa6cd60

Add application file

Browse files
Files changed (3) hide show
  1. .ipynb_checkpoints/app-checkpoint.ipynb +78 -0
  2. app.ipynb +78 -0
  3. app.py +0 -13
.ipynb_checkpoints/app-checkpoint.ipynb ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "1b962101",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "Running on local URL: http://127.0.0.1:7860\n",
14
+ "Running on public URL: https://8976dd303c781f1f0e.gradio.live\n",
15
+ "\n",
16
+ "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"
17
+ ]
18
+ },
19
+ {
20
+ "data": {
21
+ "text/html": [
22
+ "<div><iframe src=\"https://8976dd303c781f1f0e.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
23
+ ],
24
+ "text/plain": [
25
+ "<IPython.core.display.HTML object>"
26
+ ]
27
+ },
28
+ "metadata": {},
29
+ "output_type": "display_data"
30
+ }
31
+ ],
32
+ "source": [
33
+ "import gradio as gr\n",
34
+ "\n",
35
+ "def esfera(raio,calculo):\n",
36
+ " if (calculo==\"perimetro\"):\n",
37
+ " return 2*raio*3.14\n",
38
+ "\n",
39
+ " if (calculo==\"area\"):\n",
40
+ " return 3.14*raio**2\n",
41
+ "\n",
42
+ "iface = gr.Interface(fn=esfera,\n",
43
+ " inputs=[gr.Slider(1, 20,1),\n",
44
+ " gr.Dropdown([\"perimetro\", \"area\"])], outputs=\"number\")\n",
45
+ "iface.launch(debug=True, share=True)"
46
+ ]
47
+ },
48
+ {
49
+ "cell_type": "code",
50
+ "execution_count": null,
51
+ "id": "0a6f6d0a",
52
+ "metadata": {},
53
+ "outputs": [],
54
+ "source": []
55
+ }
56
+ ],
57
+ "metadata": {
58
+ "kernelspec": {
59
+ "display_name": "Python 3 (ipykernel)",
60
+ "language": "python",
61
+ "name": "python3"
62
+ },
63
+ "language_info": {
64
+ "codemirror_mode": {
65
+ "name": "ipython",
66
+ "version": 3
67
+ },
68
+ "file_extension": ".py",
69
+ "mimetype": "text/x-python",
70
+ "name": "python",
71
+ "nbconvert_exporter": "python",
72
+ "pygments_lexer": "ipython3",
73
+ "version": "3.10.9"
74
+ }
75
+ },
76
+ "nbformat": 4,
77
+ "nbformat_minor": 5
78
+ }
app.ipynb ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "1b962101",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "Running on local URL: http://127.0.0.1:7860\n",
14
+ "Running on public URL: https://8976dd303c781f1f0e.gradio.live\n",
15
+ "\n",
16
+ "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"
17
+ ]
18
+ },
19
+ {
20
+ "data": {
21
+ "text/html": [
22
+ "<div><iframe src=\"https://8976dd303c781f1f0e.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
23
+ ],
24
+ "text/plain": [
25
+ "<IPython.core.display.HTML object>"
26
+ ]
27
+ },
28
+ "metadata": {},
29
+ "output_type": "display_data"
30
+ }
31
+ ],
32
+ "source": [
33
+ "import gradio as gr\n",
34
+ "\n",
35
+ "def esfera(raio,calculo):\n",
36
+ " if (calculo==\"perimetro\"):\n",
37
+ " return 2*raio*3.14\n",
38
+ "\n",
39
+ " if (calculo==\"area\"):\n",
40
+ " return 3.14*raio**2\n",
41
+ "\n",
42
+ "iface = gr.Interface(fn=esfera,\n",
43
+ " inputs=[gr.Slider(1, 20,1),\n",
44
+ " gr.Dropdown([\"perimetro\", \"area\"])], outputs=\"number\")\n",
45
+ "iface.launch(debug=True, share=True)"
46
+ ]
47
+ },
48
+ {
49
+ "cell_type": "code",
50
+ "execution_count": null,
51
+ "id": "0a6f6d0a",
52
+ "metadata": {},
53
+ "outputs": [],
54
+ "source": []
55
+ }
56
+ ],
57
+ "metadata": {
58
+ "kernelspec": {
59
+ "display_name": "Python 3 (ipykernel)",
60
+ "language": "python",
61
+ "name": "python3"
62
+ },
63
+ "language_info": {
64
+ "codemirror_mode": {
65
+ "name": "ipython",
66
+ "version": 3
67
+ },
68
+ "file_extension": ".py",
69
+ "mimetype": "text/x-python",
70
+ "name": "python",
71
+ "nbconvert_exporter": "python",
72
+ "pygments_lexer": "ipython3",
73
+ "version": "3.10.9"
74
+ }
75
+ },
76
+ "nbformat": 4,
77
+ "nbformat_minor": 5
78
+ }
app.py DELETED
@@ -1,13 +0,0 @@
1
- import gradio as gr
2
-
3
- def esfera(raio,calculo):
4
- if (calculo=="perimetro"):
5
- return 2*raio*3.14
6
-
7
- if (calculo=="area"):
8
- return 3.14*raio**2
9
-
10
- iface = gr.Interface(fn=esfera,
11
- inputs=[gr.Slider(1, 20,1),
12
- gr.Dropdown(["perimetro", "area"])], outputs="number")
13
- iface.launch(debug=True, share=True)