kndambuki commited on
Commit
8739567
·
verified ·
1 Parent(s): b786644

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -43
app.py CHANGED
@@ -13,52 +13,52 @@ from Gradio_UI import GradioUI
13
  @tool
14
  def destiny_still_arrives(name:str, age_or_dob:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
- """A tool that takes a name, age or date of birth as input. It outputs the meaning of the name, an image of that person's birthstone and a horoscope reading of the day.
17
- Args:
18
- name: A string representing a person's age
19
- age_or_dob: A string representing a person's age or date of birth
20
- """
21
- def get_birthstone(name: str, age_or_dob: str):
22
- birthstones = {
23
- "January": "Garnet",
24
- "February": "Amethyst",
25
- "March": "Aquamarine",
26
- "April": "Diamond",
27
- "May": "Emerald",
28
- "June": "Pearl",
29
- "July": "Ruby",
30
- "August": "Peridot",
31
- "September": "Sapphire",
32
- "October": "Opal",
33
- "November": "Topaz",
34
- "December": "Turquoise"
35
- }
36
 
37
- month = datetime.strptime(age_or_dob, "%Y-%m-%d").strftime("%B")
38
- birthstone = birthstones.get(month, "Unknown")
39
 
40
- image_urls = {
41
- "Garnet": "https://upload.wikimedia.org/wikipedia/commons/1/12/Garnet_rough.jpg",
42
- "Amethyst": "https://upload.wikimedia.org/wikipedia/commons/8/8b/Amethyst.jpg",
43
- "Aquamarine": "https://upload.wikimedia.org/wikipedia/commons/d/d5/Aquamarine_Brazil.jpg",
44
- "Diamond": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Loose_diamond.png",
45
- "Emerald": "https://upload.wikimedia.org/wikipedia/commons/4/4f/Emerald.jpg",
46
- "Pearl": "https://upload.wikimedia.org/wikipedia/commons/1/17/Pearl_macro.jpg",
47
- "Ruby": "https://upload.wikimedia.org/wikipedia/commons/0/0d/Ruby.jpg",
48
- "Peridot": "https://upload.wikimedia.org/wikipedia/commons/8/8a/Peridot.jpg",
49
- "Sapphire": "https://upload.wikimedia.org/wikipedia/commons/3/35/Sapphire.jpg",
50
- "Opal": "https://upload.wikimedia.org/wikipedia/commons/2/2f/Opal_macro.jpg",
51
- "Topaz": "https://upload.wikimedia.org/wikipedia/commons/5/56/Topaz.jpg",
52
- "Turquoise": "https://upload.wikimedia.org/wikipedia/commons/d/d6/Turquoise.jpg"
53
- }
54
 
55
- if birthstone in image_urls:
56
- response = requests.get(image_urls[birthstone])
57
- img = Image.open(BytesIO(response.content))
58
- img.show()
59
- return f"Hello {name}, your birthstone is {birthstone}!"
60
- else:
61
- return f"Hello {name}, we could not determine your birthstone."
62
 
63
  return get_birthstone
64
 
 
13
  @tool
14
  def destiny_still_arrives(name:str, age_or_dob:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
+ # """A tool that takes a name, age or date of birth as input. It outputs the meaning of the name, an image of that person's birthstone and a horoscope reading of the day.
17
+ # Args:
18
+ # name: A string representing a person's age
19
+ # age_or_dob: A string representing a person's age or date of birth
20
+ # """
21
+ # def get_birthstone(name: str, age_or_dob: str):
22
+ # birthstones = {
23
+ # "January": "Garnet",
24
+ # "February": "Amethyst",
25
+ # "March": "Aquamarine",
26
+ # "April": "Diamond",
27
+ # "May": "Emerald",
28
+ # "June": "Pearl",
29
+ # "July": "Ruby",
30
+ # "August": "Peridot",
31
+ # "September": "Sapphire",
32
+ # "October": "Opal",
33
+ # "November": "Topaz",
34
+ # "December": "Turquoise"
35
+ # }
36
 
37
+ # month = datetime.strptime(age_or_dob, "%Y-%m-%d").strftime("%B")
38
+ # birthstone = birthstones.get(month, "Unknown")
39
 
40
+ # image_urls = {
41
+ # "Garnet": "https://upload.wikimedia.org/wikipedia/commons/1/12/Garnet_rough.jpg",
42
+ # "Amethyst": "https://upload.wikimedia.org/wikipedia/commons/8/8b/Amethyst.jpg",
43
+ # "Aquamarine": "https://upload.wikimedia.org/wikipedia/commons/d/d5/Aquamarine_Brazil.jpg",
44
+ # "Diamond": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Loose_diamond.png",
45
+ # "Emerald": "https://upload.wikimedia.org/wikipedia/commons/4/4f/Emerald.jpg",
46
+ # "Pearl": "https://upload.wikimedia.org/wikipedia/commons/1/17/Pearl_macro.jpg",
47
+ # "Ruby": "https://upload.wikimedia.org/wikipedia/commons/0/0d/Ruby.jpg",
48
+ # "Peridot": "https://upload.wikimedia.org/wikipedia/commons/8/8a/Peridot.jpg",
49
+ # "Sapphire": "https://upload.wikimedia.org/wikipedia/commons/3/35/Sapphire.jpg",
50
+ # "Opal": "https://upload.wikimedia.org/wikipedia/commons/2/2f/Opal_macro.jpg",
51
+ # "Topaz": "https://upload.wikimedia.org/wikipedia/commons/5/56/Topaz.jpg",
52
+ # "Turquoise": "https://upload.wikimedia.org/wikipedia/commons/d/d6/Turquoise.jpg"
53
+ # }
54
 
55
+ # if birthstone in image_urls:
56
+ # response = requests.get(image_urls[birthstone])
57
+ # img = Image.open(BytesIO(response.content))
58
+ # img.show()
59
+ # return f"Hello {name}, your birthstone is {birthstone}!"
60
+ # else:
61
+ # return f"Hello {name}, we could not determine your birthstone."
62
 
63
  return get_birthstone
64