joohyeonhf commited on
Commit
aa520ab
·
verified ·
1 Parent(s): 3fdb183

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -34,6 +34,21 @@ def get_current_time_in_timezone(timezone: str) -> str:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  final_answer = FinalAnswerTool()
38
  model = HfApiModel(
39
  max_tokens=2096,
@@ -44,8 +59,7 @@ model = HfApiModel(
44
  )
45
 
46
 
47
- # Import tool from Hub
48
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
49
 
50
  with open("prompts.yaml", 'r') as stream:
51
  prompt_templates = yaml.safe_load(stream)
 
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
 
37
+ # image generation tool
38
+ @tool
39
+ def image_generator(prompt: str) -> str:
40
+ """Generates an image based on the given text prompt using an AI model.
41
+ Args:
42
+ prompt: A text description of the image to generate.
43
+ Returns:
44
+ The URL of the generated image.
45
+ """
46
+ # Import tool from Hub
47
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
48
+ result = image_generation_tool(prompt=prompt)
49
+ return result
50
+
51
+
52
  final_answer = FinalAnswerTool()
53
  model = HfApiModel(
54
  max_tokens=2096,
 
59
  )
60
 
61
 
62
+
 
63
 
64
  with open("prompts.yaml", 'r') as stream:
65
  prompt_templates = yaml.safe_load(stream)