import gradio as gr from nltk.corpus import wordnet as wn # Function to get the definition of the first synset for a given word def get_synset_definition(word): synsets = wn.synsets(word) if synsets: first_synset = synsets[0] return first_synset.definition() else: return "No synsets found for the given word." # Gradio Interface iface = gr.Interface( fn=get_synset_definition, inputs=gr.Textbox(), outputs=gr.Textbox(), live=True, title="WordNet Synset Definition", description="Enter a word to get the definition of its first WordNet synset.", ) # Launch the Gradio interface iface.launch()