T9_But_Bad / app.py
ierhon's picture
Update app.py
0d85766
raw
history blame
457 Bytes
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()