Spaces:
Sleeping
Sleeping
Update random_charactor_generator.py
Browse files- random_charactor_generator.py +12 -66
random_charactor_generator.py
CHANGED
@@ -35,70 +35,16 @@ class RandomCharatorGeneratorTool(Tool):
|
|
35 |
self.is_initialized = True
|
36 |
|
37 |
def __call__(self, input:str="", *args, **kwargs):
|
38 |
-
if not self.is_initialized:
|
39 |
-
self.setup()
|
40 |
-
|
41 |
-
API_URL = "https://randomuser.me/api/"
|
42 |
-
|
43 |
-
response = requests.get(API_URL)
|
44 |
-
data = response.json()['results'][0]
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
},
|
59 |
-
"city": data['location']['city'],
|
60 |
-
"state": data['location']['state'],
|
61 |
-
"country": data['location']['country'],
|
62 |
-
"postcode": data['location']['postcode'],
|
63 |
-
"coordinates": {
|
64 |
-
"latitude": data['location']['coordinates']['latitude'],
|
65 |
-
"longitude": data['location']['coordinates']['longitude']
|
66 |
-
},
|
67 |
-
"timezone": {
|
68 |
-
"offset": data['location']['timezone']['offset'],
|
69 |
-
"description": data['location']['timezone']['description']
|
70 |
-
}
|
71 |
-
},
|
72 |
-
"email": data['email'],
|
73 |
-
"login": {
|
74 |
-
"uuid": data['login']['uuid'],
|
75 |
-
"username": data['login']['username'],
|
76 |
-
"password": data['login']['password'],
|
77 |
-
"salt": data['login']['salt'],
|
78 |
-
"md5": data['login']['md5'],
|
79 |
-
"sha1": data['login']['sha1'],
|
80 |
-
"sha256": data['login']['sha256']
|
81 |
-
},
|
82 |
-
"dob": {
|
83 |
-
"date": data['dob']['date'],
|
84 |
-
"age": data['dob']['age']
|
85 |
-
},
|
86 |
-
"registered": {
|
87 |
-
"date": data['registered']['date'],
|
88 |
-
"age": data['registered']['age']
|
89 |
-
},
|
90 |
-
"phone": data['phone'],
|
91 |
-
"cell": data['cell'],
|
92 |
-
"id": {
|
93 |
-
"name": data['id']['name'],
|
94 |
-
"value": data['id']['value']
|
95 |
-
},
|
96 |
-
"picture": {
|
97 |
-
"large": data['picture']['large'],
|
98 |
-
"medium": data['picture']['medium'],
|
99 |
-
"thumbnail": data['picture']['thumbnail']
|
100 |
-
},
|
101 |
-
"nat": data['nat']
|
102 |
-
}
|
103 |
-
|
104 |
-
return {"character": character}
|
|
|
35 |
self.is_initialized = True
|
36 |
|
37 |
def __call__(self, input:str="", *args, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
text = '''
|
40 |
+
// Get the current time
|
41 |
+
<span id=time></span>
|
42 |
+
var now = new Date();
|
43 |
+
var hours = now.getHours();
|
44 |
+
var minutes = now.getMinutes();
|
45 |
+
var seconds = now.getSeconds();
|
46 |
+
|
47 |
+
// Add the time to a HTML element
|
48 |
+
document.querySelector('#time').innerText = hours + ':' + minutes + ':' + seconds;"
|
49 |
+
'''
|
50 |
+
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|