judebebo32 commited on
Commit
74136b0
1 Parent(s): 5d15de7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -5,6 +5,7 @@ from nltk.tokenize import word_tokenize
5
  from sklearn.feature_extraction.text import TfidfVectorizer
6
  from sklearn.metrics.pairwise import cosine_similarity
7
  from flask import Flask, request, jsonify
 
8
 
9
  # Initialize the Flask app
10
  app = Flask(__name__)
@@ -14,7 +15,8 @@ nltk.download('punkt')
14
  nltk.download('stopwords')
15
 
16
  # Load customer inquiries dataset
17
- with open('my_text_file.txt', 'r') as f:
 
18
  data = f.readlines()
19
 
20
  # Preprocess data
@@ -52,5 +54,6 @@ def chat():
52
  else:
53
  return jsonify({'error': 'No message provided'}), 400
54
 
 
55
  if __name__ == '__main__':
56
  app.run(host='0.0.0.0', port=8080)
 
5
  from sklearn.feature_extraction.text import TfidfVectorizer
6
  from sklearn.metrics.pairwise import cosine_similarity
7
  from flask import Flask, request, jsonify
8
+ import os
9
 
10
  # Initialize the Flask app
11
  app = Flask(__name__)
 
15
  nltk.download('stopwords')
16
 
17
  # Load customer inquiries dataset
18
+ file_path = os.path.join(os.path.dirname(__file__), 'my_text_file.txt')
19
+ with open(file_path, 'r') as f:
20
  data = f.readlines()
21
 
22
  # Preprocess data
 
54
  else:
55
  return jsonify({'error': 'No message provided'}), 400
56
 
57
+ # Main entry
58
  if __name__ == '__main__':
59
  app.run(host='0.0.0.0', port=8080)