예제 #1
0
import requests, json
import speech_recognition as sr
import re
import googlemaps
import playsound
import pyttsx3
from stt_conversion import voice
v = voice()
print(v)
engine = pyttsx3.init()
query = v
api_key = 'AIzaSyDevDlcD-iiGG4qOs1OE8ZKsi11HTODjtA'

url = "https://maps.googleapis.com/maps/api/place/textsearch/json?"

url2 = "https://maps.googleapis.com/maps/api/place/details/json?"

r = requests.get(url + 'query=' + query + '&key=' + api_key)
x = r.json()

y = x['results']
# print(x)

# Opening Hours
pl = str(y[0]["place_id"])
name = str(y[0]["name"])
print("Place Id: ", pl)
print("Name :", name)

g = requests.get(url2 + 'place_id=' + "{}".format(pl) + '&key=' + api_key)
j = g.json()
예제 #2
0
파일: weather.py 프로젝트: iamjai-3/code
# pip install stt_conversion
from stt_conversion import voice
import random
import speech_recognition as sr
import pyttsx3
import webbrowser
import pyowm
import requests, json
import re

engine = pyttsx3.init()

Weather_API_KEY = "64f270d8dc07242b28b7cdd3a6080bc0"

text = voice()

f = str(text)
print("You said : {}".format(text))
g = f.split()
city_name = g[5]
say = ['tell me the weather of {}'.format(city_name)]

if f in say:

    complete_url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=64f270d8dc07242b28b7cdd3a6080bc0&units=metric'.format(
        city_name)

    response = requests.get(complete_url)
    x = response.json()
    temp = x['main']['temp']
    wind_speed = x['wind']['speed']
예제 #3
0
# SAY -> CONVERT VALUE "ml" to "litres"

from stt_conversion import voice
m = voice()
t = m.lower()
op = t.split()
print(op)

def getConvertfrom():
    return op[2]

def getConvertto():
    return op[4]


if "cubic" in op[2] and len(op) <= 6:
    global fromc,toc
    k = op[2] + op [3]
    fromc = k
    toc = op[5]
    print(k)
    num1 = float(op[1])

elif "cubic" in t and len(op) > 6:    
    k = op[2] + op[3]
    l= op[5] + op[6]
    fromc = k
    toc = l
    print(l)
    num1 = float(op[1])
예제 #4
0
# SAY -> CONVERT VALUE "kilomts" to "mtrs"
from stt_conversion import voice
t = voice()
op = t.split()
print(op)


def getConvertfrom():
    return op[2]


def getConvertto():
    return op[4]


num1 = float(op[1])

available_units = ('millimetre', 'centimetre', 'metre', 'kilometre', 'inches',
                   'feet', 'yards', 'miles')
conversions = (1, 10, 1000, 1e6, 25.4, 304.8, 914.4, 1.609344E6)

fromc = getConvertfrom()
toc = getConvertto()

index = 0
for i in range(0, len(available_units)):
    # print (available_units[i], '==', str(fromc))
    if available_units[i] == str(fromc):
        num_in_mm = num1 * conversions[i]

for j in range(0, len(available_units)):