Update server.py
Browse files
server.py
CHANGED
|
@@ -1,16 +1,20 @@
|
|
| 1 |
from flask import Flask, request, jsonify
|
| 2 |
-
from
|
| 3 |
-
from vid2sum_model import Vid2SumModel
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
| 6 |
-
|
| 7 |
|
| 8 |
@app.route('/predict', methods=['POST'])
|
| 9 |
def predict():
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|