Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,6 +134,16 @@ def document_qna_tool(pdf_path: str, question: str) -> str:
|
|
| 134 |
except Exception as e:
|
| 135 |
return f"[EXCEPTION] {type(e).__name__}: {str(e)}\n{traceback.format_exc()}"
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
# -------------------- Other Components --------------------
|
| 138 |
final_answer = FinalAnswerTool()
|
| 139 |
search_tool = DuckDuckGoSearchTool()
|
|
@@ -145,14 +155,6 @@ model = HfApiModel(
|
|
| 145 |
custom_role_conversions=None,
|
| 146 |
)
|
| 147 |
|
| 148 |
-
from smolagents import Tool
|
| 149 |
-
|
| 150 |
-
image_generation_tool = Tool.from_space(
|
| 151 |
-
"black-forest-labs/FLUX.1-schnell",
|
| 152 |
-
name="image_generator", # You can name it whatever makes sense for your agent
|
| 153 |
-
description="Generate an image from a prompt"
|
| 154 |
-
)
|
| 155 |
-
|
| 156 |
with open("prompts.yaml", 'r') as stream:
|
| 157 |
prompt_templates = yaml.safe_load(stream)
|
| 158 |
|
|
|
|
| 134 |
except Exception as e:
|
| 135 |
return f"[EXCEPTION] {type(e).__name__}: {str(e)}\n{traceback.format_exc()}"
|
| 136 |
|
| 137 |
+
# -------------------- TOOL 4: Image Generation --------------------
|
| 138 |
+
|
| 139 |
+
from smolagents import Tool
|
| 140 |
+
|
| 141 |
+
image_generation_tool = Tool.from_space(
|
| 142 |
+
"black-forest-labs/FLUX.1-schnell",
|
| 143 |
+
name="image_generator", # You can name it whatever makes sense for your agent
|
| 144 |
+
description="Generate an image from a prompt"
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
# -------------------- Other Components --------------------
|
| 148 |
final_answer = FinalAnswerTool()
|
| 149 |
search_tool = DuckDuckGoSearchTool()
|
|
|
|
| 155 |
custom_role_conversions=None,
|
| 156 |
)
|
| 157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
with open("prompts.yaml", 'r') as stream:
|
| 159 |
prompt_templates = yaml.safe_load(stream)
|
| 160 |
|