-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDogTyper.py
50 lines (43 loc) · 1.22 KB
/
DogTyper.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import random
import string
from hugchat import hugchat
from hugchat.login import Login
import requests
import json
import webbrowser
def dog():
f = r"https://random.dog/woof.json"
page = requests.get(f)
data = json.loads(page.text)
webbrowser.open(data["url"])
dog()
# Hugging chat login
sign = Login('YOURUSERNAMEHERE', 'YOURPASSWORDHERE') # Hugging chat login details
cookies = sign.login()
cookie_path_dir = "./cookies"
# Hugging chat bot
dogChat = hugchat.ChatBot(cookies=cookies.get_dict())
query_result = dogChat.chat("Write a creative description of a dog that has a job consisting of typing on a typewriter, in this format:Name:____ Age:____ Description:____ ")
print(query_result)
# Dog Typewriting
text = input('Your Text:')
mtext = ''
textLength = len(text) + 1
allLetter = string.ascii_lowercase + ' '
while textLength > 1:
mtext = mtext + allLetter[random.randrange(0,27)]
textLength -= 1
i = 0
chance = 0
ch = 27
for x in mtext:
if x == text[i]:
print(f'yes, it was {x}')
chance += 1
i += 1
ch = ch**chance
print(mtext)
if (1/ch)*100 == 100:
print('The dog did not match any characters')
else:
print(f'The chance of this dog matching {chance} characters is {(1/ch)*100}%')