Spaces:
Build error
Build error
Commit
·
b5a86a6
1
Parent(s):
8490ec5
add initial version
Browse files- .gitattributes +6 -0
- app.py +21 -0
- examples/es-wikipedia.png +3 -0
- examples/pt-wikipedia.png +3 -0
- examples/ru-rt.png +3 -0
- examples/ru-wikipedia.png +3 -0
- export.pkl +3 -0
- requirements.txt +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
export.pkl filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples/pt-wikipedia.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
examples/ru-rt.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
examples/ru-wikipedia.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
examples/es-wikipedia.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''
|
| 2 |
+
Create an interface for the model using Gradio.
|
| 3 |
+
'''
|
| 4 |
+
|
| 5 |
+
from fastai.vision.all import *
|
| 6 |
+
import gradio as gr
|
| 7 |
+
|
| 8 |
+
learn = load_learner("export.pkl")
|
| 9 |
+
|
| 10 |
+
categories = ("Non-Russian text", "Russian text")
|
| 11 |
+
|
| 12 |
+
base_path = "examples/"
|
| 13 |
+
examples = ["es-wikipedia.png", "pt-wikipedia.png", "ru-rt.png", "ru-wikipedia.png"]
|
| 14 |
+
examples = [base_path + filename for filename in examples]
|
| 15 |
+
|
| 16 |
+
def classify_image(img):
|
| 17 |
+
pred,idx,probs = learn.predict(img)
|
| 18 |
+
return dict(zip(categories, map(float,probs)))
|
| 19 |
+
|
| 20 |
+
demo = gr.Interface(fn=classify_image, inputs="image", outputs="text", examples=examples, live=True)
|
| 21 |
+
demo.launch()
|
examples/es-wikipedia.png
ADDED
|
Git LFS Details
|
examples/pt-wikipedia.png
ADDED
|
Git LFS Details
|
examples/ru-rt.png
ADDED
|
Git LFS Details
|
examples/ru-wikipedia.png
ADDED
|
Git LFS Details
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f627239c06f3000493021707ff1fc425bec1798a82a91a19caabda2927dbf1b
|
| 3 |
+
size 354807136
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai==2.7.19
|