Spaces:
Runtime error
Runtime error
import gradio as gr | |
import difflib,time,numpy | |
# Dictionary | |
dictionaryFile=open('words.txt','r') # Open words file | |
dictionary=dictionaryFile.readlines() # Read words file into list | |
# Work | |
def get_matches(text): | |
try: | |
return(difflib.get_close_matches(text, dictionary,1)[0].replace("\n", "")) | |
except Exception as ex: # Print error if error | |
return(ex) | |
iface = gr.Interface(fn=get_matches, inputs="text", outputs="text") | |
iface.launch() | |