-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatures.py
More file actions
31 lines (24 loc) · 913 Bytes
/
features.py
File metadata and controls
31 lines (24 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pyowm
import news
import requests
import playsound
import os
# from duckduckgo_search import DDGS
from gpt4all import GPT4All
def weather(location, temp_type, key=os.getenv("open_weather")):
owm = pyowm.OWM(key)
weather_mgr = owm.weather_manager()
observation = weather_mgr.weather_at_place(location)
temperature = observation.weather.temperature(temp_type)["temp"]
humidity = observation.weather.humidity
wind = observation.weather.wind()['speed']
return f"The temperature is {temperature}, With a Humidity of {humidity}% ,and a wind speed of {wind}"
def npr():
newsFile = requests.get(news.xml2url(news.podFetch()))
open('file.mp3', 'wb').write(newsFile.content)
playsound.playsound('file.mp3', True)
def search(quere, model):
model = GPT4All(model)
with model.chat_session():
response = model.generate(prompt=quere)
return response