Open SubhashKsr opened 7 years ago
ok
pip install googlesearch-python
from flask import Flask, render_template, request, jsonify from googlesearch import search
app = Flask(name)
@app.route("/") def hello(): return render_template('chat.html')
@app.route("/ask", methods=['POST']) def ask(): message = str(request.form['messageText'])
# kernel now ready for use
while True:
if message == "quit":
exit()
else:
search_results = search(message, num_results=2)
if len(search_results) > 1:
bot_response = search_results[1]
else:
bot_response = "Mi dispiace, non ho trovato informazioni sulla tua richiesta."
print(bot_response)
# return bot_response
return jsonify({'status': 'OK', 'answer': bot_response})
if name == "main": app.run(debug=True)
c'e molto da fare
Followed the following steps, as mentioned in ReadMe
Installation
Clone and navigate to chatbot directory.
Install modules.
Run the python server.
After this step, I am seeing the following error, tried surfing a little about that but couldnt fix it. Please help me out.
[ksr@ksr-PC: ~/Documents/Google-Search-Chatbot-master ] python main.py Traceback (most recent call last): File "main.py", line 3, in
from google import google
ImportError: cannot import name google