EdenSw commited on
Commit
f8cd92f
·
1 Parent(s): e11cc5a

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +11 -7
server.py CHANGED
@@ -1,16 +1,20 @@
1
  from flask import Flask, request, jsonify
2
- from moviepy.editor import *
3
- from vid2sum_model import Vid2SumModel
4
 
5
  app = Flask(__name__)
6
- model = Vid2SumModel()
7
 
8
  @app.route('/predict', methods=['POST'])
9
  def predict():
10
- file = request.files['video']
11
- file.save('uploaded_video.mp4') # Save the uploaded video file
12
- summary_text = model.predict('uploaded_video.mp4') # Call your model's predict method
13
- return jsonify({'summary_text': summary_text})
 
 
 
 
 
14
 
15
  if __name__ == '__main__':
16
  app.run()
 
1
  from flask import Flask, request, jsonify
2
+ from summarize import Vid2Sum
 
3
 
4
  app = Flask(__name__)
5
+
6
 
7
  @app.route('/predict', methods=['POST'])
8
  def predict():
9
+ # Check if video file is included in the request
10
+ if 'video' not in request.files:
11
+ return jsonify({'error': 'No video file found'}), 400
12
+
13
+ video_file = request.files['video']
14
+ # Perform video-to-text conversion using your existing code
15
+ text_output = video_to_text(video_file)
16
+
17
+ return jsonify({'text': text_output})
18
 
19
  if __name__ == '__main__':
20
  app.run()