from flask import Flask, render_template_string, request, jsonify from chatbot_memory import get_response import os app = Flask(__name__) # Read the HTML template (you can save the HTML artifact as templates/index.html instead) def get_html_template(): # For now, we'll include the HTML inline. # You can move it to templates/index.html later if preferred return """ Voyager – Your AI Travel Companion

🌍 Voyager

Your AI Travel Companion

Welcome to Voyager!

Plan your next adventure effortlessly. Just tell me your destination! ✈️

Voyager is thinking
""" @app.route('/') def home(): return render_template_string(get_html_template()) @app.route('/chat', methods=['POST']) def chat(): try: data = request.get_json() message = data.get('message', '') history = data.get('history', []) # Get response from your existing chatbot_memory module response = get_response(message, history) response = response.replace('\n', '
') return jsonify({'response': response}) except Exception as e: print(f"Error: {e}") return jsonify({'error': 'Something went wrong'}), 500 if __name__ == "__main__": app.run(debug=True, host='0.0.0.0', port=7860)#7860 in hugging face and 5000 in github