vyraun / Google-Search-Chatbot

A rudimentary Chatbot powered by Google Search.
2 stars 0 forks source link

File "main.py", line 3, in <module> from google import google #1

Open SubhashKsr opened 7 years ago

SubhashKsr commented 7 years ago

Followed the following steps, as mentioned in ReadMe

Installation

  1. Clone and navigate to chatbot directory.

  2. Install modules.

    pip install Flask
    pip install Google-Search-API
  3. Run the python server.

    
    python main.py

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

Daniel-code-lang commented 4 years ago

ok

griditalianet commented 1 year ago

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)

griditalianet commented 1 year ago

c'e molto da fare