File size: 1,482 Bytes
18c67b8
 
8a96b9e
 
 
b33c97b
 
8a96b9e
c38fd4a
6f717a8
0e0d5e8
337a24b
ed85e4b
4003082
ed85e4b
18c67b8
715f449
 
2053e54
18c67b8
 
e319431
39aa976
c38fd4a
0e0d5e8
ed85e4b
18c67b8
ed85e4b
18c67b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr

############################################################ This is still under progress #######################
#def formatdata(dframe):
#return
#https://huggingface.co/spaces/ttj/wordle-helper/blob/main/app.py
#https://raw.githubusercontent.com/dwyl/english-words/master/words.txt

def wordsrch(img):
    lang = ["en"]
    #ocrimg = gr.Interface.load("spaces/PaddlePaddle/PaddleOCR")(img, lang)
    ocrimg, dframe = gr.Interface.load("spaces/tomofi/EasyOCR")(img, lang)
    print(dframe)
    #formatdata(dframe)
    return ocrimg 

#examples = [["wordsearch2.jpg","en"]]
examples = ["wordsearch2.jpg"]
words = ["allude", "lest", "apples", "lore", "lorna", "brunner", "buccaneer", "northward", "decently", "plessey", "dialled", "pointing", "duce", "protestor", "fairer", "removable", "finality", "risc", "gasp", "skates", "hawk", "spoke", "insomnia", "lear", "troll"]

iface = gr.Interface(fn=wordsrch, 
                      description = "Work in progress ...",
                      # Please choose from: 'numpy', 'pil', 'filepath'.
                      inputs=gr.inputs.Image(type='filepath', label='Input'), #"en"],  
                      #outputs=gr.outputs.Image(type='file', label='Output'),
                      outputs=gr.outputs.Image(type='file', label='Output'), #gr.outputs.Dataframe(type="array", headers=['text' , 'confidence'])],
                      examples = examples)
                      
iface.launch(debug=True, enable_queue=True)