darshan8950 commited on
Commit
7f188aa
·
1 Parent(s): 77dc987

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -17
main.py CHANGED
@@ -12,8 +12,6 @@ import threading
12
  app = Flask(__name__)
13
 
14
  # Configuration for SQLite database
15
-
16
-
17
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///faces.db'
18
  app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
19
  db = SQLAlchemy(app)
@@ -115,21 +113,8 @@ def video_feed():
115
  def home():
116
  return jsonify(message='Welcome to the Hugging Face Space!')
117
 
118
-
119
  @app.route('/get_frames', methods=['GET'])
120
  def get_frames():
121
- instance_folder = app.instance_path
122
- db_file_path = os.path.join(instance_folder, 'faces.db')
123
-
124
- # Check if the instance folder is present
125
- if not os.path.exists(instance_folder):
126
- return jsonify({'error': 'Instance folder not present'}), 500
127
-
128
- # Check if the faces.db file exists
129
- if not os.path.exists(db_file_path):
130
- return jsonify({'error': 'faces.db not present in the instance folder'}), 500
131
-
132
- # Continue with the normal operation if everything is present
133
  frames = Frame.query.all()
134
  frames_data = []
135
 
@@ -141,9 +126,7 @@ def get_frames():
141
 
142
  return jsonify(frames_data)
143
 
144
-
145
  if __name__ == '__main__':
146
  with app.app_context():
147
  create_database()
148
- print("Database Created")
149
  app.run(debug=True)
 
12
  app = Flask(__name__)
13
 
14
  # Configuration for SQLite database
 
 
15
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///faces.db'
16
  app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
17
  db = SQLAlchemy(app)
 
113
  def home():
114
  return jsonify(message='Welcome to the Hugging Face Space!')
115
 
 
116
  @app.route('/get_frames', methods=['GET'])
117
  def get_frames():
 
 
 
 
 
 
 
 
 
 
 
 
118
  frames = Frame.query.all()
119
  frames_data = []
120
 
 
126
 
127
  return jsonify(frames_data)
128
 
 
129
  if __name__ == '__main__':
130
  with app.app_context():
131
  create_database()
 
132
  app.run(debug=True)