Spaces:
Sleeping
Sleeping
trying different def of image_generation_tool
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -34,7 +34,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
34 |
except Exception as e:
|
35 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
36 |
|
37 |
-
|
38 |
final_answer = FinalAnswerTool()
|
39 |
|
40 |
model = HfApiModel(
|
@@ -45,11 +44,12 @@ model = HfApiModel(
|
|
45 |
)
|
46 |
|
47 |
# Import tool from Hub
|
48 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
53 |
|
54 |
with open("prompts.yaml", 'r') as stream:
|
55 |
prompt_templates = yaml.safe_load(stream)
|
|
|
1 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel, load_tool, tool, Tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
|
|
34 |
except Exception as e:
|
35 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
36 |
|
|
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
39 |
model = HfApiModel(
|
|
|
44 |
)
|
45 |
|
46 |
# Import tool from Hub
|
47 |
+
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
48 |
+
image_generation_tool = Tool.from_space(
|
49 |
+
"black-forest-labs/FLUX.1-schnell",
|
50 |
+
name="image_generator",
|
51 |
+
description="This tool creates an image according to a prompt, which is a text description."
|
52 |
+
)
|
53 |
|
54 |
with open("prompts.yaml", 'r') as stream:
|
55 |
prompt_templates = yaml.safe_load(stream)
|