martinmorando commited on
Commit
b5a86a6
·
1 Parent(s): 8490ec5

add initial version

Browse files
.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

  • SHA256: f7bf94db9c04e8c9a12d4010cc95588d8c68a4692a826e2fc0bdeb9bb04853a4
  • Pointer size: 131 Bytes
  • Size of remote file: 169 kB
examples/pt-wikipedia.png ADDED

Git LFS Details

  • SHA256: 16ce36dbf4d7b371761bba75309ff44a3f151f6516d1cc6a23a381892d10cdf2
  • Pointer size: 131 Bytes
  • Size of remote file: 159 kB
examples/ru-rt.png ADDED

Git LFS Details

  • SHA256: 7fc3cd228d4438fe2fa48c6e2d434d02030454f241d7983ffd5417b560fad76c
  • Pointer size: 131 Bytes
  • Size of remote file: 124 kB
examples/ru-wikipedia.png ADDED

Git LFS Details

  • SHA256: c3ceba71ae61889bb7a7b0bcd7c9d90edd7902bd94aa00eaa7a2cff34a7d4227
  • Pointer size: 131 Bytes
  • Size of remote file: 136 kB
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