Spaces:
Runtime error
Runtime error
Trial 2
Browse filesFiles changed (3)
- .ipynb_checkpoints/Untitled-checkpoint.ipynbAdded+6
- Untitled.ipynbAdded+239
- app.py+5
123456{ "cells": [], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "e5315266", "metadata": {}, "outputs": [], "source": [ "import os \n", "os.environ[\"OMP_NUM_THREADS\"] = \"1\"" ] }, { "cell_type": "code", "execution_count": 3, "id": "e9f649d8", "metadata": {}, "outputs": [], "source": [ "from fastai.vision.all import *" ] }, { "cell_type": "code", "execution_count": 4, "id": "544abe8f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/danielching/miniforge3/envs/fastai/lib/python3.10/site-packages/fastbook/__init__.py:11: UserWarning: Missing `ipywidgets` - please install it\n", " except ModuleNotFoundError: warn(\"Missing `ipywidgets` - please install it\")\n" ] } ], "source": [ "import fastbook" ] }, { "cell_type": "code", "execution_count": 5, "id": "e1df0cec", "metadata": {}, "outputs": [], "source": [ "from fastbook import *" ] }, { "cell_type": "code", "execution_count": 6, "id": "a837a058", "metadata": {}, "outputs": [], "source": [ "fastbook.setup_book()" ] }, { "cell_type": "code", "execution_count": null, "id": "7fb42101", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading a new version of this dataset...\n" ] }, { "data": { "text/html": [ "\n", "<style>\n", " /* Turns off some styling */\n", " progress {\n", " /* gets rid of default border in Firefox and Opera. */\n", " border: none;\n", " /* Needs to be in here for Safari polyfill so background images work as expected. */\n", " background-size: auto;\n", " }\n", " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n", " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n", " }\n", " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n", " background: #F44336;\n", " }\n", "</style>\n" ], "text/plain": [ "<IPython.core.display.HTML object>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " <div>\n", " <progress value='811712512' class='' max='811706944' style='width:300px; height:20px; vertical-align: middle;'></progress>\n", " 100.00% [811712512/811706944 01:51<00:00]\n", " </div>\n", " " ], "text/plain": [ "<IPython.core.display.HTML object>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/danielching/miniforge3/envs/fastai/lib/python3.10/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.\n", " warnings.warn(\n", "/Users/danielching/miniforge3/envs/fastai/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=ResNet34_Weights.IMAGENET1K_V1`. You can also use `weights=ResNet34_Weights.DEFAULT` to get the most up-to-date weights.\n", " warnings.warn(msg)\n", "Downloading: \"https://download.pytorch.org/models/resnet34-b627a593.pth\" to /Users/danielching/.cache/torch/hub/checkpoints/resnet34-b627a593.pth\n", "100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 83.3M/83.3M [00:09<00:00, 8.84MB/s]\n" ] }, { "data": { "text/html": [ "\n", "<style>\n", " /* Turns off some styling */\n", " progress {\n", " /* gets rid of default border in Firefox and Opera. */\n", " border: none;\n", " /* Needs to be in here for Safari polyfill so background images work as expected. */\n", " background-size: auto;\n", " }\n", " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n", " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n", " }\n", " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n", " background: #F44336;\n", " }\n", "</style>\n" ], "text/plain": [ "<IPython.core.display.HTML object>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " <div>\n", " <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n", " 0.00% [0/1 00:00<?]\n", " </div>\n", " \n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: left;\">\n", " <th>epoch</th>\n", " <th>train_loss</th>\n", " <th>valid_loss</th>\n", " <th>error_rate</th>\n", " <th>time</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " </tbody>\n", "</table><p>\n", "\n", " <div>\n", " <progress value='26' class='' max='92' style='width:300px; height:20px; vertical-align: middle;'></progress>\n", " 28.26% [26/92 04:09<10:33 0.7969]\n", " </div>\n", " " ], "text/plain": [ "<IPython.core.display.HTML object>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from fastai.vision.all import *\n", "path = untar_data(URLs.PETS)/'images'\n", "\n", "def is_cat(x): return x[0].isupper()\n", "dls = ImageDataLoaders.from_name_func(\n", " path, get_image_files(path), valid_pct=0.2, seed=42,\n", " label_func=is_cat, item_tfms=Resize(224))\n", "\n", "learn = vision_learner(dls, resnet34, metrics=error_rate)\n", "learn.fine_tune(1)" ] }, { "cell_type": "code", "execution_count": null, "id": "cbbe5c41", "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.4" } }, "nbformat": 4, "nbformat_minor": 5}12345import gradio as grfrom fastai.vision.all import *_all_ = ['is_cat', 'learn', 'classify_image','categories', 'image', 'label', 'examples', 'intf']12345678910import gradio as grimport osimport fastaifrom fastai.vision.all import *os.environ["OMP_NUM_THREADS"] = "1"_all_ = ['is_cat', 'learn', 'classify_image','categories', 'image', 'label', 'examples', 'intf']
.ipynb_checkpoints/Untitled-checkpoint.ipynbAdded+6
Untitled.ipynbAdded+239
app.py+5