AMfeta99 commited on
Commit
81328c2
·
verified ·
1 Parent(s): 5658261

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -55,7 +55,7 @@ def generate_prompts_for_object(object_name):
55
  # =========================================================
56
  # Tool wrapper for m-ric/text-to-image
57
  # =========================================================
58
-
59
  class WrappedTextToImageTool(Tool):
60
  name = "text_to_image"
61
  description = "Generates an image from a text prompt using the m-ric/text-to-image tool."
@@ -73,11 +73,28 @@ class WrappedTextToImageTool(Tool):
73
  def forward(self, prompt):
74
  return self.client.text_to_image(prompt)
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  # =========================================================
77
  # Tool and Agent Initialization
78
  # =========================================================
79
-
80
- image_generation_tool = WrappedTextToImageTool()
81
  search_tool = DuckDuckGoSearchTool()
82
  llm_engine = InferenceClientModel("Qwen/Qwen2.5-72B-Instruct")
83
 
 
55
  # =========================================================
56
  # Tool wrapper for m-ric/text-to-image
57
  # =========================================================
58
+ '''
59
  class WrappedTextToImageTool(Tool):
60
  name = "text_to_image"
61
  description = "Generates an image from a text prompt using the m-ric/text-to-image tool."
 
73
  def forward(self, prompt):
74
  return self.client.text_to_image(prompt)
75
 
76
+ '''
77
+ from huggingface_hub import InferenceClient
78
+
79
+
80
+ class TextToImageTool(Tool):
81
+ description = "This tool creates an image according to a prompt, which is a text description."
82
+ name = "image_generator"
83
+ inputs = {"prompt": {"type": "string", "description": "The image generator prompt. Don't hesitate to add details in the prompt to make the image look better, like 'high-res, photorealistic', etc."}}
84
+ output_type = "image"
85
+ model_sdxl = "black-forest-labs/FLUX.1-schnell"
86
+ client = InferenceClient(model_sdxl)
87
+
88
+
89
+ def forward(self, prompt):
90
+ return self.client.text_to_image(prompt)
91
+
92
+
93
  # =========================================================
94
  # Tool and Agent Initialization
95
  # =========================================================
96
+ image_generation_tool= TextToImageTool()
97
+ #image_generation_tool = WrappedTextToImageTool()
98
  search_tool = DuckDuckGoSearchTool()
99
  llm_engine = InferenceClientModel("Qwen/Qwen2.5-72B-Instruct")
100