Ayushmukherjee commited on
Commit
d0ba33c
·
verified ·
1 Parent(s): 5c0eac2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -7,22 +7,18 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
-
11
- # Import tool from Hub
12
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
13
-
14
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
15
  @tool
16
- def image_generator(description: str)-> str: #it's import to specify the return type
17
  #Keep this format for the description / args / args description but feel free to modify the tool
18
- """A tool that generates image from a given description ...
19
  Args:
20
- description: String representing the description of image to be generated
21
  """
22
  try:
23
- return image_generation_tool(description)
24
  except Exception as e:
25
- return f"Error fetching image using '{description}': {str(e)}"
26
 
27
  @tool
28
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -48,11 +44,14 @@ final_answer = FinalAnswerTool()
48
  model = HfApiModel(
49
  max_tokens=2096,
50
  temperature=0.5,
51
- model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud' ,
52
- # model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
53
  custom_role_conversions=None,
54
  )
55
 
 
 
 
 
56
  with open("prompts.yaml", 'r') as stream:
57
  prompt_templates = yaml.safe_load(stream)
58
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
 
 
 
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def image_generator(cat_description:str)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
+ """A tool that that generates an image of a cat
15
  Args:
16
+ cat_description: A string describing the type of image of cat to generate
17
  """
18
  try:
19
+ return image_generation_tool(cat_description)
20
  except Exception as e:
21
+ return f"Error in image generation : {str(e)}"
22
 
23
  @tool
24
  def get_current_time_in_timezone(timezone: str) -> str:
 
44
  model = HfApiModel(
45
  max_tokens=2096,
46
  temperature=0.5,
47
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
 
48
  custom_role_conversions=None,
49
  )
50
 
51
+
52
+ # Import tool from Hub
53
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
54
+
55
  with open("prompts.yaml", 'r') as stream:
56
  prompt_templates = yaml.safe_load(stream)
57