Ajith09 commited on
Commit
0af8de6
1 Parent(s): f8cba30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -24,8 +24,15 @@ logging.basicConfig(level=logging.INFO)
24
  spell = Speller()
25
 
26
  # Ensure necessary NLTK data is downloaded
27
- nltk.download('punkt')
28
- nltk.download('wordnet')
 
 
 
 
 
 
 
29
 
30
  class modelPredict:
31
  def __init__(self, intents_path='Newdata.json', model_path='cbv_model.h5'):
@@ -102,6 +109,5 @@ iface = gr.Interface(
102
  description="A simple chatbot with spell correction and intent prediction.",
103
  )
104
 
105
-
106
  iface.launch(share=True)
107
-
 
24
  spell = Speller()
25
 
26
  # Ensure necessary NLTK data is downloaded
27
+ try:
28
+ nltk.data.find('tokenizers/punkt')
29
+ except LookupError:
30
+ nltk.download('punkt')
31
+
32
+ try:
33
+ nltk.data.find('corpora/wordnet')
34
+ except LookupError:
35
+ nltk.download('wordnet')
36
 
37
  class modelPredict:
38
  def __init__(self, intents_path='Newdata.json', model_path='cbv_model.h5'):
 
109
  description="A simple chatbot with spell correction and intent prediction.",
110
  )
111
 
112
+ # Launch the Gradio interface
113
  iface.launch(share=True)