Spaces:
Runtime error
Runtime error
Commit ·
96b02f4
1
Parent(s): f231729
replaced app with notebook
Browse files- app.py +1 -7
- include-legomodel.ipynb +0 -1
app.py
CHANGED
|
@@ -1,7 +1 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
|
| 3 |
-
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
-
|
| 6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
-
iface.launch()
|
|
|
|
| 1 |
+
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-11T14:34:42.294835Z","iopub.execute_input":"2023-04-11T14:34:42.295371Z","iopub.status.idle":"2023-04-11T14:34:42.334200Z","shell.execute_reply.started":"2023-04-11T14:34:42.295325Z","shell.execute_reply":"2023-04-11T14:34:42.332944Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"from fastai.vision.all import *\nimport gradio as gr\n\n","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:35:10.244670Z","iopub.execute_input":"2023-04-11T14:35:10.245105Z","iopub.status.idle":"2023-04-11T14:35:16.105057Z","shell.execute_reply.started":"2023-04-11T14:35:10.245055Z","shell.execute_reply":"2023-04-11T14:35:16.102961Z"},"trusted":true},"execution_count":3,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)","\u001b[0;32m/tmp/ipykernel_27/903241981.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mfastai\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvision\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mall\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mgradio\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mgr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'gradio'"],"ename":"ModuleNotFoundError","evalue":"No module named 'gradio'","output_type":"error"}]},{"cell_type":"code","source":" learn = load_learner('lego-bricks-model.pkl')","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.409133Z","iopub.status.idle":"2023-04-11T14:34:42.409607Z","shell.execute_reply.started":"2023-04-11T14:34:42.409387Z","shell.execute_reply":"2023-04-11T14:34:42.409411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"categories = ('3046 roof corner inside tile 2x2', '2357 brick corner 1x2x2', '18654 beam 1M')\n\ndef classify_image(img)\npred,idx,probs = learn.predict(img)\nreturn dict(zip(categories, map(float,probs)))","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.411395Z","iopub.status.idle":"2023-04-11T14:34:42.412332Z","shell.execute_reply.started":"2023-04-11T14:34:42.412028Z","shell.execute_reply":"2023-04-11T14:34:42.412068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image = gr.inputs.Image(shape=(192, 192))\nlabel = gr.outputs.Label()\nexamples = ['3046 roof corner inside tile 2x2 272L.png', '2357 brick corner 1x2x2 006L.png', '18654 beam 1M 259R.png']\n\nintf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\nintf.launch(inline=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.415004Z","iopub.status.idle":"2023-04-11T14:34:42.415583Z","shell.execute_reply.started":"2023-04-11T14:34:42.415346Z","shell.execute_reply":"2023-04-11T14:34:42.415375Z"},"trusted":true},"execution_count":null,"outputs":[]}]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include-legomodel.ipynb
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-11T14:34:42.294835Z","iopub.execute_input":"2023-04-11T14:34:42.295371Z","iopub.status.idle":"2023-04-11T14:34:42.334200Z","shell.execute_reply.started":"2023-04-11T14:34:42.295325Z","shell.execute_reply":"2023-04-11T14:34:42.332944Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"from fastai.vision.all import *\nimport gradio as gr\n\n","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:35:10.244670Z","iopub.execute_input":"2023-04-11T14:35:10.245105Z","iopub.status.idle":"2023-04-11T14:35:16.105057Z","shell.execute_reply.started":"2023-04-11T14:35:10.245055Z","shell.execute_reply":"2023-04-11T14:35:16.102961Z"},"trusted":true},"execution_count":3,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)","\u001b[0;32m/tmp/ipykernel_27/903241981.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mfastai\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvision\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mall\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mgradio\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mgr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'gradio'"],"ename":"ModuleNotFoundError","evalue":"No module named 'gradio'","output_type":"error"}]},{"cell_type":"code","source":" learn = load_learner('lego-bricks-model.pkl')","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.409133Z","iopub.status.idle":"2023-04-11T14:34:42.409607Z","shell.execute_reply.started":"2023-04-11T14:34:42.409387Z","shell.execute_reply":"2023-04-11T14:34:42.409411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"categories = ('3046 roof corner inside tile 2x2', '2357 brick corner 1x2x2', '18654 beam 1M')\n\ndef classify_image(img)\npred,idx,probs = learn.predict(img)\nreturn dict(zip(categories, map(float,probs)))","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.411395Z","iopub.status.idle":"2023-04-11T14:34:42.412332Z","shell.execute_reply.started":"2023-04-11T14:34:42.412028Z","shell.execute_reply":"2023-04-11T14:34:42.412068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image = gr.inputs.Image(shape=(192, 192))\nlabel = gr.outputs.Label()\nexamples = ['3046 roof corner inside tile 2x2 272L.png', '2357 brick corner 1x2x2 006L.png', '18654 beam 1M 259R.png']\n\nintf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\nintf.launch(inline=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-11T14:34:42.415004Z","iopub.status.idle":"2023-04-11T14:34:42.415583Z","shell.execute_reply.started":"2023-04-11T14:34:42.415346Z","shell.execute_reply":"2023-04-11T14:34:42.415375Z"},"trusted":true},"execution_count":null,"outputs":[]}]}
|
|
|
|
|
|