Benedetto Scala commited on
Commit
00ea52c
·
1 Parent(s): 1b32c48
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -52,9 +52,17 @@ custom_role_conversions=None,
52
  )
53
 
54
 
55
- # Import tool from Hub
56
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
57
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  with open("prompts.yaml", 'r') as stream:
60
  prompt_templates = yaml.safe_load(stream)
 
52
  )
53
 
54
 
 
 
55
 
56
+ def image_generation_tool(prompt:str, token:str) -> str:
57
+ """A tool that generates an image from a text prompt.
58
+
59
+ Args:
60
+ prompt: The text prompt to generate an image from.
61
+ token: The API token to use for the image generation tool.
62
+ """
63
+ # Call the image generation tool with the provided prompt and API token
64
+ response = image_generation_tool(prompt=prompt, token=token)
65
+ return response
66
 
67
  with open("prompts.yaml", 'r') as stream:
68
  prompt_templates = yaml.safe_load(stream)