Spaces:
Runtime error
Runtime error
profnecrya
commited on
Commit
·
c70cfd4
1
Parent(s):
1e4f75b
main files
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import difflib,time,numpy
|
3 |
+
# Dictionary
|
4 |
+
dictionaryFile=open('words.txt','r') # Open words file
|
5 |
+
dictionary=dictionaryFile.readlines() # Read words file into list
|
6 |
+
|
7 |
+
# Work
|
8 |
+
def get_matches(text):
|
9 |
+
while True: # Work cycle
|
10 |
+
try:
|
11 |
+
return(difflib.get_close_matches(text, dictionary,1)[0].replace("\n", ""))
|
12 |
+
time.sleep(.1)
|
13 |
+
except Exception as ex: # Print error if error
|
14 |
+
return(ex)
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=get_matches, inputs="text", outputs="text")
|
17 |
+
iface.launch()
|
words.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|