Spaces:
Sleeping
Sleeping
Commit ·
ce91d74
1
Parent(s): 71bebb6
Complete Overhaul and Linux Integration
Browse files- .gitignore +6 -0
- Pets_Classification/_modidx.py +0 -8
- app +0 -79
- app.html +370 -0
- app.ipynb +10 -237
- app.py +63 -0
- settings.ini +2 -2
.gitignore
CHANGED
|
@@ -1,2 +1,8 @@
|
|
| 1 |
.ipynb_checkpoints/
|
| 2 |
Pets_Classification.ipynb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
.ipynb_checkpoints/
|
| 2 |
Pets_Classification.ipynb
|
| 3 |
+
tutorial-env/
|
| 4 |
+
test.yaml
|
| 5 |
+
settings.ini
|
| 6 |
+
app_files/
|
| 7 |
+
.vscode/
|
| 8 |
+
settings.ini
|
Pets_Classification/_modidx.py
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
# Autogenerated by nbdev
|
| 2 |
-
|
| 3 |
-
d = { 'settings': { 'branch': 'main',
|
| 4 |
-
'doc_baseurl': '/',
|
| 5 |
-
'doc_host': 'https://AyyCompadre.github.io',
|
| 6 |
-
'git_url': 'https://github.com/AyyCompadre/Pets_Classification',
|
| 7 |
-
'lib_path': 'Pets_Classification'},
|
| 8 |
-
'syms': {}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app
DELETED
|
@@ -1,79 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python
|
| 2 |
-
|
| 3 |
-
# In[ ]:
|
| 4 |
-
|
| 5 |
-
#|default_exp
|
| 6 |
-
|
| 7 |
-
# In[5]:
|
| 8 |
-
|
| 9 |
-
get_ipython().run_line_magic("pip", "install gradio==3.50")
|
| 10 |
-
get_ipython().run_line_magic("pip", "install nbdev")
|
| 11 |
-
get_ipython().run_line_magic("nbdev_migrate", '')
|
| 12 |
-
get_ipython().run_line_magic("pip", "install fastai")
|
| 13 |
-
get_ipython().run_line_magic("pip", "install ipywidgets")
|
| 14 |
-
get_ipython().run_line_magic("pip", "install git+https://github.com/fastai/nbdev.git gradio fastcore")
|
| 15 |
-
|
| 16 |
-
# In[6]:
|
| 17 |
-
|
| 18 |
-
import pathlib as pl
|
| 19 |
-
|
| 20 |
-
import gradio as gr
|
| 21 |
-
import nbdev
|
| 22 |
-
#|export
|
| 23 |
-
from fastai.vision.all import *
|
| 24 |
-
from fastcore.net import HTTPError, urljson
|
| 25 |
-
|
| 26 |
-
plt = platform.system()
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
def is_cat(x):
|
| 30 |
-
return x[0].isupper()
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
# In[ ]:
|
| 34 |
-
|
| 35 |
-
im = PILImage.create("dog.jpg")
|
| 36 |
-
im.thumbnail((192, 192))
|
| 37 |
-
im
|
| 38 |
-
|
| 39 |
-
# In[ ]:
|
| 40 |
-
|
| 41 |
-
#|export
|
| 42 |
-
if plt == "Linux":
|
| 43 |
-
pl.WindowsPath = pl.PosixPath
|
| 44 |
-
learn = load_learner("model.pkl")
|
| 45 |
-
|
| 46 |
-
# In[ ]:
|
| 47 |
-
|
| 48 |
-
learn.predict(im)
|
| 49 |
-
|
| 50 |
-
# In[ ]:
|
| 51 |
-
|
| 52 |
-
#|export
|
| 53 |
-
categories = ("Dog", "Cat")
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
def classify_image(img):
|
| 57 |
-
pred, idx, probs = learn.predict(img)
|
| 58 |
-
return dict(zip(categories, map(float, probs)))
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
# In[ ]:
|
| 62 |
-
|
| 63 |
-
classify_image(im)
|
| 64 |
-
|
| 65 |
-
# In[ ]:
|
| 66 |
-
|
| 67 |
-
#|export
|
| 68 |
-
image = gr.Image(height=192, width=192)
|
| 69 |
-
label = gr.Label()
|
| 70 |
-
examples = ["dog.jpg", "cat.jpg", "dunno.jpg"]
|
| 71 |
-
|
| 72 |
-
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 73 |
-
intf.launch(inline=False)
|
| 74 |
-
|
| 75 |
-
# In[7]:
|
| 76 |
-
|
| 77 |
-
from nbdev.export import nb_export
|
| 78 |
-
|
| 79 |
-
nb_export("app.ipynb", "app")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.html
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
| 3 |
+
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="generator" content="quarto-1.3.450">
|
| 6 |
+
|
| 7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
<title>app</title>
|
| 11 |
+
<style>
|
| 12 |
+
code{white-space: pre-wrap;}
|
| 13 |
+
span.smallcaps{font-variant: small-caps;}
|
| 14 |
+
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
| 15 |
+
div.column{flex: auto; overflow-x: auto;}
|
| 16 |
+
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
| 17 |
+
ul.task-list{list-style: none;}
|
| 18 |
+
ul.task-list li input[type="checkbox"] {
|
| 19 |
+
width: 0.8em;
|
| 20 |
+
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
| 21 |
+
vertical-align: middle;
|
| 22 |
+
}
|
| 23 |
+
/* CSS for syntax highlighting */
|
| 24 |
+
pre > code.sourceCode { white-space: pre; position: relative; }
|
| 25 |
+
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
| 26 |
+
pre > code.sourceCode > span:empty { height: 1.2em; }
|
| 27 |
+
.sourceCode { overflow: visible; }
|
| 28 |
+
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
| 29 |
+
div.sourceCode { margin: 1em 0; }
|
| 30 |
+
pre.sourceCode { margin: 0; }
|
| 31 |
+
@media screen {
|
| 32 |
+
div.sourceCode { overflow: auto; }
|
| 33 |
+
}
|
| 34 |
+
@media print {
|
| 35 |
+
pre > code.sourceCode { white-space: pre-wrap; }
|
| 36 |
+
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
| 37 |
+
}
|
| 38 |
+
pre.numberSource code
|
| 39 |
+
{ counter-reset: source-line 0; }
|
| 40 |
+
pre.numberSource code > span
|
| 41 |
+
{ position: relative; left: -4em; counter-increment: source-line; }
|
| 42 |
+
pre.numberSource code > span > a:first-child::before
|
| 43 |
+
{ content: counter(source-line);
|
| 44 |
+
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
| 45 |
+
border: none; display: inline-block;
|
| 46 |
+
-webkit-touch-callout: none; -webkit-user-select: none;
|
| 47 |
+
-khtml-user-select: none; -moz-user-select: none;
|
| 48 |
+
-ms-user-select: none; user-select: none;
|
| 49 |
+
padding: 0 4px; width: 4em;
|
| 50 |
+
}
|
| 51 |
+
pre.numberSource { margin-left: 3em; padding-left: 4px; }
|
| 52 |
+
div.sourceCode
|
| 53 |
+
{ }
|
| 54 |
+
@media screen {
|
| 55 |
+
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
<script src="app_files/libs/clipboard/clipboard.min.js"></script>
|
| 61 |
+
<script src="app_files/libs/quarto-html/quarto.js"></script>
|
| 62 |
+
<script src="app_files/libs/quarto-html/popper.min.js"></script>
|
| 63 |
+
<script src="app_files/libs/quarto-html/tippy.umd.min.js"></script>
|
| 64 |
+
<script src="app_files/libs/quarto-html/anchor.min.js"></script>
|
| 65 |
+
<link href="app_files/libs/quarto-html/tippy.css" rel="stylesheet">
|
| 66 |
+
<link href="app_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
|
| 67 |
+
<script src="app_files/libs/bootstrap/bootstrap.min.js"></script>
|
| 68 |
+
<link href="app_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
| 69 |
+
<link href="app_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
</head>
|
| 73 |
+
|
| 74 |
+
<body class="fullcontent">
|
| 75 |
+
|
| 76 |
+
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
|
| 77 |
+
|
| 78 |
+
<main class="content" id="quarto-document-content">
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
<div class="cell">
|
| 83 |
+
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>pip install gradio<span class="op">==</span><span class="fl">3.50</span></span>
|
| 84 |
+
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>pip install fastai</span>
|
| 85 |
+
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>pip install ipywidgets</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="cell">
|
| 88 |
+
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> fastai.vision.<span class="bu">all</span> <span class="im">import</span> <span class="op">*</span></span>
|
| 89 |
+
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> gradio <span class="im">as</span> gr</span>
|
| 90 |
+
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pathlib <span class="im">as</span> pl</span>
|
| 91 |
+
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a>plt <span class="op">=</span> platform.system()</span>
|
| 92 |
+
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
|
| 93 |
+
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> is_cat(x): <span class="cf">return</span> x[<span class="dv">0</span>].isupper()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 94 |
+
</div>
|
| 95 |
+
<div class="cell">
|
| 96 |
+
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>im <span class="op">=</span> PILImage.create(<span class="st">'dog.jpg'</span>)</span>
|
| 97 |
+
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>im.thumbnail((<span class="dv">192</span>,<span class="dv">192</span>))</span>
|
| 98 |
+
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>im</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="cell">
|
| 101 |
+
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> plt <span class="op">==</span> <span class="st">'Linux'</span> : pl.WindowsPath <span class="op">=</span> pl.PosixPath</span>
|
| 102 |
+
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>learn <span class="op">=</span> load_learner(<span class="st">'model.pkl'</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 103 |
+
</div>
|
| 104 |
+
<div class="cell">
|
| 105 |
+
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>learn.predict(im)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="cell">
|
| 108 |
+
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>categories <span class="op">=</span> (<span class="st">'Dog'</span>, <span class="st">'Cat'</span>)</span>
|
| 109 |
+
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
|
| 110 |
+
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> classify_image(img):</span>
|
| 111 |
+
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> pred,idx,probs <span class="op">=</span> learn.predict(img)</span>
|
| 112 |
+
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="bu">dict</span>(<span class="bu">zip</span>(categories, <span class="bu">map</span>(<span class="bu">float</span>,probs)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="cell">
|
| 115 |
+
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>classify_image(im)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="cell">
|
| 118 |
+
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>image <span class="op">=</span> gr.Image(height<span class="op">=</span><span class="dv">192</span>, width <span class="op">=</span> <span class="dv">192</span>)</span>
|
| 119 |
+
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>label <span class="op">=</span> gr.Label()</span>
|
| 120 |
+
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>examples <span class="op">=</span> [<span class="st">'dog.jpg'</span>, <span class="st">'cat.jpg'</span>, <span class="st">'dunno.jpg'</span>]</span>
|
| 121 |
+
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a></span>
|
| 122 |
+
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a>intf <span class="op">=</span> gr.Interface(fn<span class="op">=</span>classify_image, inputs <span class="op">=</span> image, outputs<span class="op">=</span>label, examples <span class="op">=</span> examples)</span>
|
| 123 |
+
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a>intf.launch(inline<span class="op">=</span><span class="va">False</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 124 |
+
</div>
|
| 125 |
+
<div class="cell">
|
| 126 |
+
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> jupytext</span>
|
| 127 |
+
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>nb <span class="op">=</span> jupytext.read(<span class="st">"app.ipynb"</span>)</span>
|
| 128 |
+
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a>jupytext.write(nb, <span class="st">"app.py"</span>, fmt <span class="op">=</span> <span class="st">"qmd"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
</main>
|
| 132 |
+
<!-- /main column -->
|
| 133 |
+
<script id="quarto-html-after-body" type="application/javascript">
|
| 134 |
+
window.document.addEventListener("DOMContentLoaded", function (event) {
|
| 135 |
+
const toggleBodyColorMode = (bsSheetEl) => {
|
| 136 |
+
const mode = bsSheetEl.getAttribute("data-mode");
|
| 137 |
+
const bodyEl = window.document.querySelector("body");
|
| 138 |
+
if (mode === "dark") {
|
| 139 |
+
bodyEl.classList.add("quarto-dark");
|
| 140 |
+
bodyEl.classList.remove("quarto-light");
|
| 141 |
+
} else {
|
| 142 |
+
bodyEl.classList.add("quarto-light");
|
| 143 |
+
bodyEl.classList.remove("quarto-dark");
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
const toggleBodyColorPrimary = () => {
|
| 147 |
+
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
| 148 |
+
if (bsSheetEl) {
|
| 149 |
+
toggleBodyColorMode(bsSheetEl);
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
toggleBodyColorPrimary();
|
| 153 |
+
const icon = "";
|
| 154 |
+
const anchorJS = new window.AnchorJS();
|
| 155 |
+
anchorJS.options = {
|
| 156 |
+
placement: 'right',
|
| 157 |
+
icon: icon
|
| 158 |
+
};
|
| 159 |
+
anchorJS.add('.anchored');
|
| 160 |
+
const isCodeAnnotation = (el) => {
|
| 161 |
+
for (const clz of el.classList) {
|
| 162 |
+
if (clz.startsWith('code-annotation-')) {
|
| 163 |
+
return true;
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
return false;
|
| 167 |
+
}
|
| 168 |
+
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
| 169 |
+
text: function(trigger) {
|
| 170 |
+
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
| 171 |
+
for (const childEl of codeEl.children) {
|
| 172 |
+
if (isCodeAnnotation(childEl)) {
|
| 173 |
+
childEl.remove();
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
return codeEl.innerText;
|
| 177 |
+
}
|
| 178 |
+
});
|
| 179 |
+
clipboard.on('success', function(e) {
|
| 180 |
+
// button target
|
| 181 |
+
const button = e.trigger;
|
| 182 |
+
// don't keep focus
|
| 183 |
+
button.blur();
|
| 184 |
+
// flash "checked"
|
| 185 |
+
button.classList.add('code-copy-button-checked');
|
| 186 |
+
var currentTitle = button.getAttribute("title");
|
| 187 |
+
button.setAttribute("title", "Copied!");
|
| 188 |
+
let tooltip;
|
| 189 |
+
if (window.bootstrap) {
|
| 190 |
+
button.setAttribute("data-bs-toggle", "tooltip");
|
| 191 |
+
button.setAttribute("data-bs-placement", "left");
|
| 192 |
+
button.setAttribute("data-bs-title", "Copied!");
|
| 193 |
+
tooltip = new bootstrap.Tooltip(button,
|
| 194 |
+
{ trigger: "manual",
|
| 195 |
+
customClass: "code-copy-button-tooltip",
|
| 196 |
+
offset: [0, -8]});
|
| 197 |
+
tooltip.show();
|
| 198 |
+
}
|
| 199 |
+
setTimeout(function() {
|
| 200 |
+
if (tooltip) {
|
| 201 |
+
tooltip.hide();
|
| 202 |
+
button.removeAttribute("data-bs-title");
|
| 203 |
+
button.removeAttribute("data-bs-toggle");
|
| 204 |
+
button.removeAttribute("data-bs-placement");
|
| 205 |
+
}
|
| 206 |
+
button.setAttribute("title", currentTitle);
|
| 207 |
+
button.classList.remove('code-copy-button-checked');
|
| 208 |
+
}, 1000);
|
| 209 |
+
// clear code selection
|
| 210 |
+
e.clearSelection();
|
| 211 |
+
});
|
| 212 |
+
function tippyHover(el, contentFn) {
|
| 213 |
+
const config = {
|
| 214 |
+
allowHTML: true,
|
| 215 |
+
content: contentFn,
|
| 216 |
+
maxWidth: 500,
|
| 217 |
+
delay: 100,
|
| 218 |
+
arrow: false,
|
| 219 |
+
appendTo: function(el) {
|
| 220 |
+
return el.parentElement;
|
| 221 |
+
},
|
| 222 |
+
interactive: true,
|
| 223 |
+
interactiveBorder: 10,
|
| 224 |
+
theme: 'quarto',
|
| 225 |
+
placement: 'bottom-start'
|
| 226 |
+
};
|
| 227 |
+
window.tippy(el, config);
|
| 228 |
+
}
|
| 229 |
+
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
| 230 |
+
for (var i=0; i<noterefs.length; i++) {
|
| 231 |
+
const ref = noterefs[i];
|
| 232 |
+
tippyHover(ref, function() {
|
| 233 |
+
// use id or data attribute instead here
|
| 234 |
+
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
| 235 |
+
try { href = new URL(href).hash; } catch {}
|
| 236 |
+
const id = href.replace(/^#\/?/, "");
|
| 237 |
+
const note = window.document.getElementById(id);
|
| 238 |
+
return note.innerHTML;
|
| 239 |
+
});
|
| 240 |
+
}
|
| 241 |
+
let selectedAnnoteEl;
|
| 242 |
+
const selectorForAnnotation = ( cell, annotation) => {
|
| 243 |
+
let cellAttr = 'data-code-cell="' + cell + '"';
|
| 244 |
+
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
| 245 |
+
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
| 246 |
+
return selector;
|
| 247 |
+
}
|
| 248 |
+
const selectCodeLines = (annoteEl) => {
|
| 249 |
+
const doc = window.document;
|
| 250 |
+
const targetCell = annoteEl.getAttribute("data-target-cell");
|
| 251 |
+
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
| 252 |
+
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
| 253 |
+
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
| 254 |
+
const lineIds = lines.map((line) => {
|
| 255 |
+
return targetCell + "-" + line;
|
| 256 |
+
})
|
| 257 |
+
let top = null;
|
| 258 |
+
let height = null;
|
| 259 |
+
let parent = null;
|
| 260 |
+
if (lineIds.length > 0) {
|
| 261 |
+
//compute the position of the single el (top and bottom and make a div)
|
| 262 |
+
const el = window.document.getElementById(lineIds[0]);
|
| 263 |
+
top = el.offsetTop;
|
| 264 |
+
height = el.offsetHeight;
|
| 265 |
+
parent = el.parentElement.parentElement;
|
| 266 |
+
if (lineIds.length > 1) {
|
| 267 |
+
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
| 268 |
+
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
| 269 |
+
height = bottom - top;
|
| 270 |
+
}
|
| 271 |
+
if (top !== null && height !== null && parent !== null) {
|
| 272 |
+
// cook up a div (if necessary) and position it
|
| 273 |
+
let div = window.document.getElementById("code-annotation-line-highlight");
|
| 274 |
+
if (div === null) {
|
| 275 |
+
div = window.document.createElement("div");
|
| 276 |
+
div.setAttribute("id", "code-annotation-line-highlight");
|
| 277 |
+
div.style.position = 'absolute';
|
| 278 |
+
parent.appendChild(div);
|
| 279 |
+
}
|
| 280 |
+
div.style.top = top - 2 + "px";
|
| 281 |
+
div.style.height = height + 4 + "px";
|
| 282 |
+
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
| 283 |
+
if (gutterDiv === null) {
|
| 284 |
+
gutterDiv = window.document.createElement("div");
|
| 285 |
+
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
| 286 |
+
gutterDiv.style.position = 'absolute';
|
| 287 |
+
const codeCell = window.document.getElementById(targetCell);
|
| 288 |
+
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
| 289 |
+
gutter.appendChild(gutterDiv);
|
| 290 |
+
}
|
| 291 |
+
gutterDiv.style.top = top - 2 + "px";
|
| 292 |
+
gutterDiv.style.height = height + 4 + "px";
|
| 293 |
+
}
|
| 294 |
+
selectedAnnoteEl = annoteEl;
|
| 295 |
+
}
|
| 296 |
+
};
|
| 297 |
+
const unselectCodeLines = () => {
|
| 298 |
+
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
| 299 |
+
elementsIds.forEach((elId) => {
|
| 300 |
+
const div = window.document.getElementById(elId);
|
| 301 |
+
if (div) {
|
| 302 |
+
div.remove();
|
| 303 |
+
}
|
| 304 |
+
});
|
| 305 |
+
selectedAnnoteEl = undefined;
|
| 306 |
+
};
|
| 307 |
+
// Attach click handler to the DT
|
| 308 |
+
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
| 309 |
+
for (const annoteDlNode of annoteDls) {
|
| 310 |
+
annoteDlNode.addEventListener('click', (event) => {
|
| 311 |
+
const clickedEl = event.target;
|
| 312 |
+
if (clickedEl !== selectedAnnoteEl) {
|
| 313 |
+
unselectCodeLines();
|
| 314 |
+
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
| 315 |
+
if (activeEl) {
|
| 316 |
+
activeEl.classList.remove('code-annotation-active');
|
| 317 |
+
}
|
| 318 |
+
selectCodeLines(clickedEl);
|
| 319 |
+
clickedEl.classList.add('code-annotation-active');
|
| 320 |
+
} else {
|
| 321 |
+
// Unselect the line
|
| 322 |
+
unselectCodeLines();
|
| 323 |
+
clickedEl.classList.remove('code-annotation-active');
|
| 324 |
+
}
|
| 325 |
+
});
|
| 326 |
+
}
|
| 327 |
+
const findCites = (el) => {
|
| 328 |
+
const parentEl = el.parentElement;
|
| 329 |
+
if (parentEl) {
|
| 330 |
+
const cites = parentEl.dataset.cites;
|
| 331 |
+
if (cites) {
|
| 332 |
+
return {
|
| 333 |
+
el,
|
| 334 |
+
cites: cites.split(' ')
|
| 335 |
+
};
|
| 336 |
+
} else {
|
| 337 |
+
return findCites(el.parentElement)
|
| 338 |
+
}
|
| 339 |
+
} else {
|
| 340 |
+
return undefined;
|
| 341 |
+
}
|
| 342 |
+
};
|
| 343 |
+
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
| 344 |
+
for (var i=0; i<bibliorefs.length; i++) {
|
| 345 |
+
const ref = bibliorefs[i];
|
| 346 |
+
const citeInfo = findCites(ref);
|
| 347 |
+
if (citeInfo) {
|
| 348 |
+
tippyHover(citeInfo.el, function() {
|
| 349 |
+
var popup = window.document.createElement('div');
|
| 350 |
+
citeInfo.cites.forEach(function(cite) {
|
| 351 |
+
var citeDiv = window.document.createElement('div');
|
| 352 |
+
citeDiv.classList.add('hanging-indent');
|
| 353 |
+
citeDiv.classList.add('csl-entry');
|
| 354 |
+
var biblioDiv = window.document.getElementById('ref-' + cite);
|
| 355 |
+
if (biblioDiv) {
|
| 356 |
+
citeDiv.innerHTML = biblioDiv.innerHTML;
|
| 357 |
+
}
|
| 358 |
+
popup.appendChild(citeDiv);
|
| 359 |
+
});
|
| 360 |
+
return popup.innerHTML;
|
| 361 |
+
});
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
});
|
| 365 |
+
</script>
|
| 366 |
+
</div> <!-- /content -->
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
</body></html>
|
app.ipynb
CHANGED
|
@@ -3,198 +3,8 @@
|
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
"execution_count": null,
|
| 6 |
-
"id": "14661eb4",
|
| 7 |
"metadata": {},
|
| 8 |
"outputs": [],
|
| 9 |
-
"source": [
|
| 10 |
-
"#|default_exp app"
|
| 11 |
-
]
|
| 12 |
-
},
|
| 13 |
-
{
|
| 14 |
-
"cell_type": "code",
|
| 15 |
-
"execution_count": 1,
|
| 16 |
-
"id": "ddaca300",
|
| 17 |
-
"metadata": {
|
| 18 |
-
"scrolled": false
|
| 19 |
-
},
|
| 20 |
-
"outputs": [
|
| 21 |
-
{
|
| 22 |
-
"name": "stdout",
|
| 23 |
-
"output_type": "stream",
|
| 24 |
-
"text": [
|
| 25 |
-
"Requirement already satisfied: gradio==3.50 in /usr/local/lib/python3.10/dist-packages (3.50.0)\n",
|
| 26 |
-
"Requirement already satisfied: python-multipart in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.0.6)\n",
|
| 27 |
-
"Requirement already satisfied: fastapi in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.108.0)\n",
|
| 28 |
-
"Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.8.2)\n",
|
| 29 |
-
"Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (10.2.0)\n",
|
| 30 |
-
"Requirement already satisfied: ffmpy in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.3.1)\n",
|
| 31 |
-
"Requirement already satisfied: semantic-version~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.10.0)\n",
|
| 32 |
-
"Requirement already satisfied: aiofiles<24.0,>=22.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (23.2.1)\n",
|
| 33 |
-
"Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.1.3)\n",
|
| 34 |
-
"Requirement already satisfied: gradio-client==0.6.1 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.6.1)\n",
|
| 35 |
-
"Requirement already satisfied: orjson~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.9.10)\n",
|
| 36 |
-
"Requirement already satisfied: websockets<12.0,>=10.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (11.0.3)\n",
|
| 37 |
-
"Requirement already satisfied: httpx in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.26.0)\n",
|
| 38 |
-
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.5.3)\n",
|
| 39 |
-
"Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (23.2)\n",
|
| 40 |
-
"Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.1.4)\n",
|
| 41 |
-
"Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (2.31.0)\n",
|
| 42 |
-
"Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (5.2.0)\n",
|
| 43 |
-
"Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (4.9.0)\n",
|
| 44 |
-
"Requirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (6.1.1)\n",
|
| 45 |
-
"Requirement already satisfied: uvicorn>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.25.0)\n",
|
| 46 |
-
"Requirement already satisfied: huggingface-hub>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.20.1)\n",
|
| 47 |
-
"Requirement already satisfied: pyyaml<7.0,>=5.0 in /usr/lib/python3/dist-packages (from gradio==3.50) (5.4.1)\n",
|
| 48 |
-
"Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (3.1.2)\n",
|
| 49 |
-
"Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (1.26.2)\n",
|
| 50 |
-
"Requirement already satisfied: pydub in /usr/local/lib/python3.10/dist-packages (from gradio==3.50) (0.25.1)\n",
|
| 51 |
-
"Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.6.1->gradio==3.50) (2023.12.2)\n",
|
| 52 |
-
"Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (0.12.0)\n",
|
| 53 |
-
"Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50) (4.20.0)\n",
|
| 54 |
-
"Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (3.13.1)\n",
|
| 55 |
-
"Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.50) (4.66.1)\n",
|
| 56 |
-
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.2.0)\n",
|
| 57 |
-
"Requirement already satisfied: python-dateutil>=2.7 in /root/.local/lib/python3.10/site-packages (from matplotlib~=3.0->gradio==3.50) (2.8.2)\n",
|
| 58 |
-
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/lib/python3/dist-packages (from matplotlib~=3.0->gradio==3.50) (2.4.7)\n",
|
| 59 |
-
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (4.47.0)\n",
|
| 60 |
-
"Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (1.4.5)\n",
|
| 61 |
-
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50) (0.12.1)\n",
|
| 62 |
-
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2023.3.post1)\n",
|
| 63 |
-
"Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50) (2023.4)\n",
|
| 64 |
-
"Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (0.6.0)\n",
|
| 65 |
-
"Requirement already satisfied: pydantic-core==2.14.6 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.50) (2.14.6)\n",
|
| 66 |
-
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.6)\n",
|
| 67 |
-
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2023.11.17)\n",
|
| 68 |
-
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (2.1.0)\n",
|
| 69 |
-
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.50) (3.3.2)\n",
|
| 70 |
-
"Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.50) (0.14.0)\n",
|
| 71 |
-
"Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.50) (8.1.7)\n",
|
| 72 |
-
"Requirement already satisfied: starlette<0.33.0,>=0.29.0 in /usr/local/lib/python3.10/dist-packages (from fastapi->gradio==3.50) (0.32.0.post1)\n",
|
| 73 |
-
"Requirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (4.2.0)\n",
|
| 74 |
-
"Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (1.3.0)\n",
|
| 75 |
-
"Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50) (1.0.2)\n",
|
| 76 |
-
"Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.16.2)\n",
|
| 77 |
-
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (2023.12.1)\n",
|
| 78 |
-
"Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (0.32.0)\n",
|
| 79 |
-
"Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50) (23.2.0)\n",
|
| 80 |
-
"Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio==3.50) (1.16.0)\n",
|
| 81 |
-
"Requirement already satisfied: exceptiongroup>=1.0.2 in /root/.local/lib/python3.10/site-packages (from anyio->httpx->gradio==3.50) (1.2.0)\n",
|
| 82 |
-
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
|
| 83 |
-
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n",
|
| 84 |
-
"Requirement already satisfied: fastai in /usr/local/lib/python3.10/dist-packages (2.7.13)\n",
|
| 85 |
-
"Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from fastai) (2.31.0)\n",
|
| 86 |
-
"Requirement already satisfied: torchvision>=0.11 in /usr/local/lib/python3.10/dist-packages (from fastai) (0.16.2)\n",
|
| 87 |
-
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from fastai) (3.8.2)\n",
|
| 88 |
-
"Requirement already satisfied: fastdownload<2,>=0.0.5 in /usr/local/lib/python3.10/dist-packages (from fastai) (0.0.7)\n",
|
| 89 |
-
"Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from fastai) (5.4.1)\n",
|
| 90 |
-
"Requirement already satisfied: spacy<4 in /usr/local/lib/python3.10/dist-packages (from fastai) (3.7.2)\n",
|
| 91 |
-
"Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from fastai) (2.1.4)\n",
|
| 92 |
-
"Requirement already satisfied: fastcore<1.6,>=1.5.29 in /usr/local/lib/python3.10/dist-packages (from fastai) (1.5.29)\n",
|
| 93 |
-
"Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from fastai) (1.11.4)\n",
|
| 94 |
-
"Requirement already satisfied: pillow>=9.0.0 in /usr/local/lib/python3.10/dist-packages (from fastai) (10.2.0)\n",
|
| 95 |
-
"Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from fastai) (23.2)\n",
|
| 96 |
-
"Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from fastai) (1.3.2)\n",
|
| 97 |
-
"Requirement already satisfied: torch<2.2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from fastai) (2.1.2)\n",
|
| 98 |
-
"Requirement already satisfied: pip in /usr/lib/python3/dist-packages (from fastai) (22.0.2)\n",
|
| 99 |
-
"Requirement already satisfied: fastprogress>=0.2.4 in /usr/local/lib/python3.10/dist-packages (from fastai) (1.0.3)\n",
|
| 100 |
-
"Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (4.66.1)\n",
|
| 101 |
-
"Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (3.0.9)\n",
|
| 102 |
-
"Requirement already satisfied: typer<0.10.0,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (0.9.0)\n",
|
| 103 |
-
"Requirement already satisfied: weasel<0.4.0,>=0.1.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (0.3.4)\n",
|
| 104 |
-
"Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (3.0.12)\n",
|
| 105 |
-
"Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (1.0.5)\n",
|
| 106 |
-
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (2.5.3)\n",
|
| 107 |
-
"Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from spacy<4->fastai) (59.6.0)\n",
|
| 108 |
-
"Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (2.0.10)\n",
|
| 109 |
-
"Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (1.0.10)\n",
|
| 110 |
-
"Requirement already satisfied: thinc<8.3.0,>=8.1.8 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (8.2.2)\n",
|
| 111 |
-
"Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (3.3.0)\n",
|
| 112 |
-
"Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (3.1.2)\n",
|
| 113 |
-
"Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (2.4.8)\n",
|
| 114 |
-
"Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (2.0.8)\n",
|
| 115 |
-
"Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (1.1.2)\n",
|
| 116 |
-
"Requirement already satisfied: numpy>=1.19.0 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (1.26.2)\n",
|
| 117 |
-
"Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /usr/local/lib/python3.10/dist-packages (from spacy<4->fastai) (6.4.0)\n",
|
| 118 |
-
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->fastai) (3.3.2)\n",
|
| 119 |
-
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->fastai) (3.6)\n",
|
| 120 |
-
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->fastai) (2023.11.17)\n",
|
| 121 |
-
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->fastai) (2.1.0)\n",
|
| 122 |
-
"Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.105)\n",
|
| 123 |
-
"Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.105)\n",
|
| 124 |
-
"Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (4.9.0)\n",
|
| 125 |
-
"Requirement already satisfied: triton==2.1.0 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (2.1.0)\n",
|
| 126 |
-
"Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.0.106)\n",
|
| 127 |
-
"Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (1.12)\n",
|
| 128 |
-
"Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (2023.12.2)\n",
|
| 129 |
-
"Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (10.3.2.106)\n",
|
| 130 |
-
"Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.3.1)\n",
|
| 131 |
-
"Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (3.2.1)\n",
|
| 132 |
-
"Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (3.13.1)\n",
|
| 133 |
-
"Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (8.9.2.26)\n",
|
| 134 |
-
"Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.105)\n",
|
| 135 |
-
"Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (11.4.5.107)\n",
|
| 136 |
-
"Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (2.18.1)\n",
|
| 137 |
-
"Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (11.0.2.54)\n",
|
| 138 |
-
"Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch<2.2,>=1.10->fastai) (12.1.105)\n",
|
| 139 |
-
"Requirement already satisfied: nvidia-nvjitlink-cu12 in /usr/local/lib/python3.10/dist-packages (from nvidia-cusolver-cu12==11.4.5.107->torch<2.2,>=1.10->fastai) (12.3.101)\n",
|
| 140 |
-
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/lib/python3/dist-packages (from matplotlib->fastai) (2.4.7)\n",
|
| 141 |
-
"Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->fastai) (1.4.5)\n",
|
| 142 |
-
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->fastai) (0.12.1)\n",
|
| 143 |
-
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->fastai) (1.2.0)\n",
|
| 144 |
-
"Requirement already satisfied: python-dateutil>=2.7 in /root/.local/lib/python3.10/site-packages (from matplotlib->fastai) (2.8.2)\n",
|
| 145 |
-
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->fastai) (4.47.0)\n",
|
| 146 |
-
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->fastai) (2023.3.post1)\n",
|
| 147 |
-
"Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->fastai) (2023.4)\n",
|
| 148 |
-
"Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->fastai) (1.3.2)\n",
|
| 149 |
-
"Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->fastai) (3.2.0)\n",
|
| 150 |
-
"Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<4->fastai) (0.6.0)\n",
|
| 151 |
-
"Requirement already satisfied: pydantic-core==2.14.6 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<4->fastai) (2.14.6)\n",
|
| 152 |
-
"Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib->fastai) (1.16.0)\n",
|
| 153 |
-
"Requirement already satisfied: confection<1.0.0,>=0.0.1 in /usr/local/lib/python3.10/dist-packages (from thinc<8.3.0,>=8.1.8->spacy<4->fastai) (0.1.4)\n",
|
| 154 |
-
"Requirement already satisfied: blis<0.8.0,>=0.7.8 in /usr/local/lib/python3.10/dist-packages (from thinc<8.3.0,>=8.1.8->spacy<4->fastai) (0.7.11)\n",
|
| 155 |
-
"Requirement already satisfied: click<9.0.0,>=7.1.1 in /usr/local/lib/python3.10/dist-packages (from typer<0.10.0,>=0.3.0->spacy<4->fastai) (8.1.7)\n",
|
| 156 |
-
"Requirement already satisfied: cloudpathlib<0.17.0,>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from weasel<0.4.0,>=0.1.0->spacy<4->fastai) (0.16.0)\n",
|
| 157 |
-
"Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->spacy<4->fastai) (2.1.3)\n",
|
| 158 |
-
"Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch<2.2,>=1.10->fastai) (1.3.0)\n",
|
| 159 |
-
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
|
| 160 |
-
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n",
|
| 161 |
-
"Requirement already satisfied: ipywidgets in /usr/local/lib/python3.10/dist-packages (8.0.4)\n",
|
| 162 |
-
"Requirement already satisfied: widgetsnbextension~=4.0 in /usr/local/lib/python3.10/dist-packages (from ipywidgets) (4.0.9)\n",
|
| 163 |
-
"Requirement already satisfied: ipython>=6.1.0 in /root/.local/lib/python3.10/site-packages (from ipywidgets) (8.19.0)\n",
|
| 164 |
-
"Requirement already satisfied: traitlets>=4.3.1 in /root/.local/lib/python3.10/site-packages (from ipywidgets) (5.14.1)\n",
|
| 165 |
-
"Requirement already satisfied: jupyterlab-widgets~=3.0 in /usr/local/lib/python3.10/dist-packages (from ipywidgets) (3.0.9)\n",
|
| 166 |
-
"Requirement already satisfied: ipykernel>=4.5.1 in /root/.local/lib/python3.10/site-packages (from ipywidgets) (6.28.0)\n",
|
| 167 |
-
"Requirement already satisfied: jupyter-client>=6.1.12 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (8.6.0)\n",
|
| 168 |
-
"Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.5.1->ipywidgets) (1.5.8)\n",
|
| 169 |
-
"Requirement already satisfied: debugpy>=1.6.5 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (1.8.0)\n",
|
| 170 |
-
"Requirement already satisfied: comm>=0.1.1 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (0.2.1)\n",
|
| 171 |
-
"Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.5.1->ipywidgets) (5.9.7)\n",
|
| 172 |
-
"Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.5.1->ipywidgets) (23.2)\n",
|
| 173 |
-
"Requirement already satisfied: pyzmq>=24 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (25.1.2)\n",
|
| 174 |
-
"Requirement already satisfied: tornado>=6.1 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (6.4)\n",
|
| 175 |
-
"Requirement already satisfied: matplotlib-inline>=0.1 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (0.1.6)\n",
|
| 176 |
-
"Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /root/.local/lib/python3.10/site-packages (from ipykernel>=4.5.1->ipywidgets) (5.6.1)\n",
|
| 177 |
-
"Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.10/dist-packages (from ipython>=6.1.0->ipywidgets) (2.17.2)\n",
|
| 178 |
-
"Requirement already satisfied: pexpect>4.3 in /root/.local/lib/python3.10/site-packages (from ipython>=6.1.0->ipywidgets) (4.9.0)\n",
|
| 179 |
-
"Requirement already satisfied: jedi>=0.16 in /root/.local/lib/python3.10/site-packages (from ipython>=6.1.0->ipywidgets) (0.19.1)\n",
|
| 180 |
-
"Requirement already satisfied: decorator in /root/.local/lib/python3.10/site-packages (from ipython>=6.1.0->ipywidgets) (5.1.1)\n",
|
| 181 |
-
"Requirement already satisfied: exceptiongroup in /root/.local/lib/python3.10/site-packages (from ipython>=6.1.0->ipywidgets) (1.2.0)\n",
|
| 182 |
-
"Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /usr/local/lib/python3.10/dist-packages (from ipython>=6.1.0->ipywidgets) (3.0.43)\n",
|
| 183 |
-
"Requirement already satisfied: stack-data in /root/.local/lib/python3.10/site-packages (from ipython>=6.1.0->ipywidgets) (0.6.3)\n",
|
| 184 |
-
"Requirement already satisfied: parso<0.9.0,>=0.8.3 in /root/.local/lib/python3.10/site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets) (0.8.3)\n",
|
| 185 |
-
"Requirement already satisfied: python-dateutil>=2.8.2 in /root/.local/lib/python3.10/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets) (2.8.2)\n",
|
| 186 |
-
"Requirement already satisfied: platformdirs>=2.5 in /root/.local/lib/python3.10/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel>=4.5.1->ipywidgets) (4.1.0)\n",
|
| 187 |
-
"Requirement already satisfied: ptyprocess>=0.5 in /root/.local/lib/python3.10/site-packages (from pexpect>4.3->ipython>=6.1.0->ipywidgets) (0.7.0)\n",
|
| 188 |
-
"Requirement already satisfied: wcwidth in /usr/local/lib/python3.10/dist-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets) (0.2.12)\n",
|
| 189 |
-
"Requirement already satisfied: asttokens>=2.1.0 in /root/.local/lib/python3.10/site-packages (from stack-data->ipython>=6.1.0->ipywidgets) (2.4.1)\n",
|
| 190 |
-
"Requirement already satisfied: pure-eval in /root/.local/lib/python3.10/site-packages (from stack-data->ipython>=6.1.0->ipywidgets) (0.2.2)\n",
|
| 191 |
-
"Requirement already satisfied: executing>=1.2.0 in /root/.local/lib/python3.10/site-packages (from stack-data->ipython>=6.1.0->ipywidgets) (2.0.1)\n",
|
| 192 |
-
"Requirement already satisfied: six>=1.12.0 in /usr/lib/python3/dist-packages (from asttokens>=2.1.0->stack-data->ipython>=6.1.0->ipywidgets) (1.16.0)\n",
|
| 193 |
-
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
|
| 194 |
-
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n"
|
| 195 |
-
]
|
| 196 |
-
}
|
| 197 |
-
],
|
| 198 |
"source": [
|
| 199 |
"%pip install gradio==3.50\n",
|
| 200 |
"%pip install fastai\n",
|
|
@@ -203,12 +13,10 @@
|
|
| 203 |
},
|
| 204 |
{
|
| 205 |
"cell_type": "code",
|
| 206 |
-
"execution_count":
|
| 207 |
-
"id": "e44d41d8",
|
| 208 |
"metadata": {},
|
| 209 |
"outputs": [],
|
| 210 |
"source": [
|
| 211 |
-
"#|export\n",
|
| 212 |
"from fastai.vision.all import *\n",
|
| 213 |
"import gradio as gr\n",
|
| 214 |
"import pathlib as pl\n",
|
|
@@ -220,7 +28,6 @@
|
|
| 220 |
{
|
| 221 |
"cell_type": "code",
|
| 222 |
"execution_count": null,
|
| 223 |
-
"id": "1546f70c",
|
| 224 |
"metadata": {},
|
| 225 |
"outputs": [],
|
| 226 |
"source": [
|
|
@@ -231,12 +38,10 @@
|
|
| 231 |
},
|
| 232 |
{
|
| 233 |
"cell_type": "code",
|
| 234 |
-
"execution_count":
|
| 235 |
-
"id": "73f7b5ff",
|
| 236 |
"metadata": {},
|
| 237 |
"outputs": [],
|
| 238 |
"source": [
|
| 239 |
-
"#|export\n",
|
| 240 |
"if plt == 'Linux' : pl.WindowsPath = pl.PosixPath\n",
|
| 241 |
"learn = load_learner('model.pkl')"
|
| 242 |
]
|
|
@@ -244,10 +49,7 @@
|
|
| 244 |
{
|
| 245 |
"cell_type": "code",
|
| 246 |
"execution_count": null,
|
| 247 |
-
"
|
| 248 |
-
"metadata": {
|
| 249 |
-
"scrolled": false
|
| 250 |
-
},
|
| 251 |
"outputs": [],
|
| 252 |
"source": [
|
| 253 |
"learn.predict(im)"
|
|
@@ -256,11 +58,9 @@
|
|
| 256 |
{
|
| 257 |
"cell_type": "code",
|
| 258 |
"execution_count": null,
|
| 259 |
-
"id": "41f098ce",
|
| 260 |
"metadata": {},
|
| 261 |
"outputs": [],
|
| 262 |
"source": [
|
| 263 |
-
"#|export\n",
|
| 264 |
"categories = ('Dog', 'Cat')\n",
|
| 265 |
"\n",
|
| 266 |
"def classify_image(img):\n",
|
|
@@ -271,7 +71,6 @@
|
|
| 271 |
{
|
| 272 |
"cell_type": "code",
|
| 273 |
"execution_count": null,
|
| 274 |
-
"id": "6e1113e6",
|
| 275 |
"metadata": {},
|
| 276 |
"outputs": [],
|
| 277 |
"source": [
|
|
@@ -281,11 +80,9 @@
|
|
| 281 |
{
|
| 282 |
"cell_type": "code",
|
| 283 |
"execution_count": null,
|
| 284 |
-
"id": "0c075cb6",
|
| 285 |
"metadata": {},
|
| 286 |
"outputs": [],
|
| 287 |
"source": [
|
| 288 |
-
"#|export\n",
|
| 289 |
"image = gr.Image(height=192, width = 192)\n",
|
| 290 |
"label = gr.Label()\n",
|
| 291 |
"examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']\n",
|
|
@@ -296,51 +93,27 @@
|
|
| 296 |
},
|
| 297 |
{
|
| 298 |
"cell_type": "code",
|
| 299 |
-
"execution_count":
|
| 300 |
-
"id": "c81de2ea",
|
| 301 |
"metadata": {},
|
| 302 |
-
"outputs": [
|
| 303 |
-
{
|
| 304 |
-
"ename": "FileExistsError",
|
| 305 |
-
"evalue": "[Errno 17] File exists: 'app'",
|
| 306 |
-
"output_type": "error",
|
| 307 |
-
"traceback": [
|
| 308 |
-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 309 |
-
"\u001b[0;31mFileExistsError\u001b[0m Traceback (most recent call last)",
|
| 310 |
-
"Cell \u001b[0;32mIn[4], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m \n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m export\n\u001b[0;32m----> 3\u001b[0m \u001b[43mexport\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnb_export\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mapp.ipynb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mapp\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
|
| 311 |
-
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/nbdev/export.py:77\u001b[0m, in \u001b[0;36mnb_export\u001b[0;34m(nbname, lib_path, procs, debug, mod_maker, name)\u001b[0m\n\u001b[1;32m 73\u001b[0m warn(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNotebook \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnbname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m uses `#|export` without `#|default_exp` cell.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 74\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNote nbdev2 no longer supports nbdev1 syntax. Run `nbdev_migrate` to upgrade.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSee https://nbdev.fast.ai/getting_started.html for more information.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 76\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m---> 77\u001b[0m mm \u001b[38;5;241m=\u001b[39m \u001b[43mmod_maker\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdest\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlib_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnm\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnb_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnbname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mis_new\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mbool\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmod\u001b[49m\u001b[38;5;241;43m==\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m#\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m mm\u001b[38;5;241m.\u001b[39mmake(cells, all_cells, lib_path\u001b[38;5;241m=\u001b[39mlib_path)\n",
|
| 312 |
-
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/nbdev/maker.py:68\u001b[0m, in \u001b[0;36mModuleMaker.__init__\u001b[0;34m(self, dest, name, nb_path, is_new, parse)\u001b[0m\n\u001b[1;32m 66\u001b[0m store_attr()\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfname \u001b[38;5;241m=\u001b[39m dest\u001b[38;5;241m/\u001b[39m(name\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.py\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 68\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_new: \u001b[43mdest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 69\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m: \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfname\u001b[38;5;241m.\u001b[39mexists(), \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m does not exist\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdest2nb \u001b[38;5;241m=\u001b[39m nb_path\u001b[38;5;241m.\u001b[39mrelpath(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfname\u001b[38;5;241m.\u001b[39mparent)\u001b[38;5;241m.\u001b[39mas_posix()\n",
|
| 313 |
-
"File \u001b[0;32m/usr/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1171\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1172\u001b[0m \u001b[38;5;124;03mCreate a new directory at this given path.\u001b[39;00m\n\u001b[1;32m 1173\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n\u001b[1;32m 1177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m parents \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparent \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m:\n",
|
| 314 |
-
"\u001b[0;31mFileExistsError\u001b[0m: [Errno 17] File exists: 'app'"
|
| 315 |
-
]
|
| 316 |
-
}
|
| 317 |
-
],
|
| 318 |
"source": [
|
| 319 |
-
"import
|
| 320 |
-
"
|
| 321 |
-
"
|
| 322 |
]
|
| 323 |
}
|
| 324 |
],
|
| 325 |
"metadata": {
|
| 326 |
"kernelspec": {
|
| 327 |
-
"display_name": "
|
| 328 |
"language": "python",
|
| 329 |
"name": "python3"
|
| 330 |
},
|
| 331 |
"language_info": {
|
| 332 |
-
"codemirror_mode": {
|
| 333 |
-
"name": "ipython",
|
| 334 |
-
"version": 3
|
| 335 |
-
},
|
| 336 |
-
"file_extension": ".py",
|
| 337 |
-
"mimetype": "text/x-python",
|
| 338 |
"name": "python",
|
| 339 |
-
"nbconvert_exporter": "python",
|
| 340 |
-
"pygments_lexer": "ipython3",
|
| 341 |
"version": "3.10.12"
|
| 342 |
}
|
| 343 |
},
|
| 344 |
"nbformat": 4,
|
| 345 |
-
"nbformat_minor":
|
| 346 |
}
|
|
|
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
"execution_count": null,
|
|
|
|
| 6 |
"metadata": {},
|
| 7 |
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"source": [
|
| 9 |
"%pip install gradio==3.50\n",
|
| 10 |
"%pip install fastai\n",
|
|
|
|
| 13 |
},
|
| 14 |
{
|
| 15 |
"cell_type": "code",
|
| 16 |
+
"execution_count": null,
|
|
|
|
| 17 |
"metadata": {},
|
| 18 |
"outputs": [],
|
| 19 |
"source": [
|
|
|
|
| 20 |
"from fastai.vision.all import *\n",
|
| 21 |
"import gradio as gr\n",
|
| 22 |
"import pathlib as pl\n",
|
|
|
|
| 28 |
{
|
| 29 |
"cell_type": "code",
|
| 30 |
"execution_count": null,
|
|
|
|
| 31 |
"metadata": {},
|
| 32 |
"outputs": [],
|
| 33 |
"source": [
|
|
|
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"cell_type": "code",
|
| 41 |
+
"execution_count": null,
|
|
|
|
| 42 |
"metadata": {},
|
| 43 |
"outputs": [],
|
| 44 |
"source": [
|
|
|
|
| 45 |
"if plt == 'Linux' : pl.WindowsPath = pl.PosixPath\n",
|
| 46 |
"learn = load_learner('model.pkl')"
|
| 47 |
]
|
|
|
|
| 49 |
{
|
| 50 |
"cell_type": "code",
|
| 51 |
"execution_count": null,
|
| 52 |
+
"metadata": {},
|
|
|
|
|
|
|
|
|
|
| 53 |
"outputs": [],
|
| 54 |
"source": [
|
| 55 |
"learn.predict(im)"
|
|
|
|
| 58 |
{
|
| 59 |
"cell_type": "code",
|
| 60 |
"execution_count": null,
|
|
|
|
| 61 |
"metadata": {},
|
| 62 |
"outputs": [],
|
| 63 |
"source": [
|
|
|
|
| 64 |
"categories = ('Dog', 'Cat')\n",
|
| 65 |
"\n",
|
| 66 |
"def classify_image(img):\n",
|
|
|
|
| 71 |
{
|
| 72 |
"cell_type": "code",
|
| 73 |
"execution_count": null,
|
|
|
|
| 74 |
"metadata": {},
|
| 75 |
"outputs": [],
|
| 76 |
"source": [
|
|
|
|
| 80 |
{
|
| 81 |
"cell_type": "code",
|
| 82 |
"execution_count": null,
|
|
|
|
| 83 |
"metadata": {},
|
| 84 |
"outputs": [],
|
| 85 |
"source": [
|
|
|
|
| 86 |
"image = gr.Image(height=192, width = 192)\n",
|
| 87 |
"label = gr.Label()\n",
|
| 88 |
"examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']\n",
|
|
|
|
| 93 |
},
|
| 94 |
{
|
| 95 |
"cell_type": "code",
|
| 96 |
+
"execution_count": null,
|
|
|
|
| 97 |
"metadata": {},
|
| 98 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
"source": [
|
| 100 |
+
"import jupytext\n",
|
| 101 |
+
"nb = jupytext.read(\"app.ipynb\")\n",
|
| 102 |
+
"jupytext.write(nb, \"app.py\", fmt = \"qmd\")"
|
| 103 |
]
|
| 104 |
}
|
| 105 |
],
|
| 106 |
"metadata": {
|
| 107 |
"kernelspec": {
|
| 108 |
+
"display_name": "tutorial-env",
|
| 109 |
"language": "python",
|
| 110 |
"name": "python3"
|
| 111 |
},
|
| 112 |
"language_info": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
"name": "python",
|
|
|
|
|
|
|
| 114 |
"version": "3.10.12"
|
| 115 |
}
|
| 116 |
},
|
| 117 |
"nbformat": 4,
|
| 118 |
+
"nbformat_minor": 2
|
| 119 |
}
|
app.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ---
|
| 2 |
+
# jupyter:
|
| 3 |
+
# jupytext:
|
| 4 |
+
# text_representation:
|
| 5 |
+
# extension: .py
|
| 6 |
+
# format_name: light
|
| 7 |
+
# format_version: '1.5'
|
| 8 |
+
# jupytext_version: 1.16.0
|
| 9 |
+
# kernelspec:
|
| 10 |
+
# display_name: Python 3 (ipykernel)
|
| 11 |
+
# language: python
|
| 12 |
+
# name: python3
|
| 13 |
+
# ---
|
| 14 |
+
|
| 15 |
+
# + tags=["hide-input"]
|
| 16 |
+
# %pip install gradio==3.50
|
| 17 |
+
# %pip install fastai
|
| 18 |
+
# %pip install ipywidgets
|
| 19 |
+
|
| 20 |
+
# +
|
| 21 |
+
from fastai.vision.all import *
|
| 22 |
+
import gradio as gr
|
| 23 |
+
import pathlib as pl
|
| 24 |
+
plt = platform.system()
|
| 25 |
+
|
| 26 |
+
def is_cat(x): return x[0].isupper()
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# + tags=["hide-input"]
|
| 30 |
+
im = PILImage.create('dog.jpg')
|
| 31 |
+
im.thumbnail((192,192))
|
| 32 |
+
im
|
| 33 |
+
# -
|
| 34 |
+
|
| 35 |
+
if plt == 'Linux' : pl.WindowsPath = pl.PosixPath
|
| 36 |
+
learn = load_learner('model.pkl')
|
| 37 |
+
|
| 38 |
+
# + tags=["hide-input"]
|
| 39 |
+
learn.predict(im)
|
| 40 |
+
|
| 41 |
+
# +
|
| 42 |
+
categories = ('Dog', 'Cat')
|
| 43 |
+
|
| 44 |
+
def classify_image(img):
|
| 45 |
+
pred,idx,probs = learn.predict(img)
|
| 46 |
+
return dict(zip(categories, map(float,probs)))
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# + tags=["hide-input"]
|
| 50 |
+
classify_image(im)
|
| 51 |
+
|
| 52 |
+
# +
|
| 53 |
+
image = gr.Image(height=192, width = 192)
|
| 54 |
+
label = gr.Label()
|
| 55 |
+
examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
|
| 56 |
+
|
| 57 |
+
intf = gr.Interface(fn=classify_image, inputs = image, outputs=label, examples = examples)
|
| 58 |
+
intf.launch(inline=False)
|
| 59 |
+
|
| 60 |
+
# + tags=["hide-input"]
|
| 61 |
+
import jupytext
|
| 62 |
+
nb = jupytext.read("app.ipynb")
|
| 63 |
+
jupytext.write(nb, "app.py", fmt = "qmd")
|
settings.ini
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
|
| 5 |
### Python library ###
|
| 6 |
repo = Pets_Classification
|
| 7 |
-
lib_name =
|
| 8 |
version = 0.0.1
|
| 9 |
min_python = 3.7
|
| 10 |
license = apache2
|
|
@@ -31,7 +31,7 @@ audience = Developers
|
|
| 31 |
author = William Downing
|
| 32 |
author_email = will.downing00@gmail.com
|
| 33 |
copyright = 2024 onwards, %(author)s
|
| 34 |
-
description =
|
| 35 |
keywords = nbdev jupyter notebook python
|
| 36 |
language = English
|
| 37 |
status = 3
|
|
|
|
| 4 |
|
| 5 |
### Python library ###
|
| 6 |
repo = Pets_Classification
|
| 7 |
+
lib_name = %(repo)s
|
| 8 |
version = 0.0.1
|
| 9 |
min_python = 3.7
|
| 10 |
license = apache2
|
|
|
|
| 31 |
author = William Downing
|
| 32 |
author_email = will.downing00@gmail.com
|
| 33 |
copyright = 2024 onwards, %(author)s
|
| 34 |
+
description =
|
| 35 |
keywords = nbdev jupyter notebook python
|
| 36 |
language = English
|
| 37 |
status = 3
|