Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,8 +104,15 @@ def generate_object_history(object_name):
|
|
| 104 |
|
| 105 |
#%% Initialization of tools and AI_Agent
|
| 106 |
# Import text-to-image tool from Hub
|
|
|
|
| 107 |
image_generation_tool = load_tool("m-ric/text-to-image", cache=False)
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
# Import search tool from LangChain
|
| 110 |
from transformers.agents.search import DuckDuckGoSearchTool
|
| 111 |
search_tool = DuckDuckGoSearchTool()
|
|
|
|
| 104 |
|
| 105 |
#%% Initialization of tools and AI_Agent
|
| 106 |
# Import text-to-image tool from Hub
|
| 107 |
+
from smolagents.tools import Tool, load_tool
|
| 108 |
image_generation_tool = load_tool("m-ric/text-to-image", cache=False)
|
| 109 |
|
| 110 |
+
class WrappedTextToImageTool(Tool):
|
| 111 |
+
def run(self, *args, **kwargs):
|
| 112 |
+
return image_generation_tool(*args, **kwargs)
|
| 113 |
+
|
| 114 |
+
image_generation_tool = WrappedTextToImageTool()
|
| 115 |
+
|
| 116 |
# Import search tool from LangChain
|
| 117 |
from transformers.agents.search import DuckDuckGoSearchTool
|
| 118 |
search_tool = DuckDuckGoSearchTool()
|