ambadkar commited on
Commit
206b634
·
verified ·
1 Parent(s): 36353df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -6,7 +6,6 @@ import pytz
6
  import yaml
7
  import image
8
  from tools.final_answer import FinalAnswerTool
9
- from huggingface_hub import InferenceClient
10
 
11
  from Gradio_UI import GradioUI
12
 
@@ -36,15 +35,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
36
  except Exception as e:
37
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
38
 
39
- @tool
40
- def my_cutom_tool(prompt: str)-> image: #it's import to specify the return type
41
- #Keep this format for the description / args / args description but feel free to modify the tool
42
- """This tool creates an image according to a prompt, which is a text description.
43
- Args:
44
- prompt: The image generator prompt. Don't hesitate to add details in the prompt to make the image look better, like 'high-res, photorealistic', etc.
45
- """
46
- return InferenceClient("black-forest-labs/FLUX.1-schnell").text_to_image(prompt)
47
-
48
  final_answer = FinalAnswerTool()
49
  model = HfApiModel(
50
  max_tokens=2096,
@@ -53,6 +43,8 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
53
  custom_role_conversions=None,
54
  )
55
 
 
 
56
 
57
  with open("prompts.yaml", 'r') as stream:
58
  prompt_templates = yaml.safe_load(stream)
@@ -69,5 +61,5 @@ agent = CodeAgent(
69
  prompt_templates=prompt_templates
70
  )
71
 
72
- print(os.environ['HF_TOKEN'])
73
  GradioUI(agent).launch()
 
6
  import yaml
7
  import image
8
  from tools.final_answer import FinalAnswerTool
 
9
 
10
  from Gradio_UI import GradioUI
11
 
 
35
  except Exception as e:
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
 
 
 
 
 
 
 
 
 
38
  final_answer = FinalAnswerTool()
39
  model = HfApiModel(
40
  max_tokens=2096,
 
43
  custom_role_conversions=None,
44
  )
45
 
46
+ # Import tool from Hub
47
+ image_generator = load_tool("agents-course/text-to-image", trust_remote_code=True)
48
 
49
  with open("prompts.yaml", 'r') as stream:
50
  prompt_templates = yaml.safe_load(stream)
 
61
  prompt_templates=prompt_templates
62
  )
63
 
64
+ print("\n".join([f"- {a}" for a in agent.toolbox.keys()]))
65
  GradioUI(agent).launch()