Spaces:
Runtime error
Runtime error
Commit
·
0497aff
1
Parent(s):
c70cfd4
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,11 @@ dictionary=dictionaryFile.readlines() # Read words file into list
|
|
6 |
|
7 |
# Work
|
8 |
def get_matches(text):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
return(ex)
|
15 |
|
16 |
iface = gr.Interface(fn=get_matches, inputs="text", outputs="text")
|
17 |
iface.launch()
|
|
|
6 |
|
7 |
# Work
|
8 |
def get_matches(text):
|
9 |
+
try:
|
10 |
+
return(difflib.get_close_matches(text, dictionary,1)[0].replace("\n", ""))
|
11 |
+
time.sleep(.1)
|
12 |
+
except Exception as ex: # Print error if error
|
13 |
+
return(ex)
|
|
|
14 |
|
15 |
iface = gr.Interface(fn=get_matches, inputs="text", outputs="text")
|
16 |
iface.launch()
|