Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,10 +21,6 @@ def ask_question():
|
|
| 21 |
return jsonify({"error": "Question is required"}), 400
|
| 22 |
|
| 23 |
answer = generate_long_answer(question)
|
| 24 |
-
|
| 25 |
-
# Save to file
|
| 26 |
-
with open("/tmp/answer.txt", "w", encoding='utf-8') as f:
|
| 27 |
-
f.write(answer)
|
| 28 |
return jsonify({"question": question, "answer": answer})
|
| 29 |
|
| 30 |
except Exception as e:
|
|
@@ -32,20 +28,8 @@ def ask_question():
|
|
| 32 |
|
| 33 |
@app.route('/get_video')
|
| 34 |
def get_video():
|
| 35 |
-
|
| 36 |
-
with open("/tmp/answer.txt", "r", encoding='utf-8') as f:
|
| 37 |
-
answer = f.read()
|
| 38 |
-
|
| 39 |
-
print("Using answer for video:", answer)
|
| 40 |
-
|
| 41 |
-
# You can now use answer to generate images/video here
|
| 42 |
-
# Example:
|
| 43 |
-
# generate_video(answer) or do any processing
|
| 44 |
-
|
| 45 |
-
return redirect("https://videos.pexels.com/video-files/2098989/2098989-uhd_2560_1440_30fps.mp4")
|
| 46 |
|
| 47 |
-
except FileNotFoundError:
|
| 48 |
-
return jsonify({"error": "Answer not found. Please ask a question first."}), 404
|
| 49 |
|
| 50 |
if __name__ == '__main__':
|
| 51 |
app.run(host='0.0.0.0', port=7860)
|
|
|
|
| 21 |
return jsonify({"error": "Question is required"}), 400
|
| 22 |
|
| 23 |
answer = generate_long_answer(question)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
return jsonify({"question": question, "answer": answer})
|
| 25 |
|
| 26 |
except Exception as e:
|
|
|
|
| 28 |
|
| 29 |
@app.route('/get_video')
|
| 30 |
def get_video():
|
| 31 |
+
return redirect("https://videos.pexels.com/video-files/2098989/2098989-uhd_2560_1440_30fps.mp4")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if __name__ == '__main__':
|
| 35 |
app.run(host='0.0.0.0', port=7860)
|