Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,27 @@ from slack_bolt.adapter.socket_mode import SocketModeHandler
|
|
4 |
import logging
|
5 |
from slack_sdk import WebClient
|
6 |
from slack_sdk.errors import SlackApiError
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
logging.basicConfig(level=logging.INFO)
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Initializes your app with your bot token and socket mode handler
|
11 |
app = App(token=os.environ.get("SLACK_BOT_TOKEN"))
|
12 |
|
|
|
4 |
import logging
|
5 |
from slack_sdk import WebClient
|
6 |
from slack_sdk.errors import SlackApiError
|
7 |
+
from transformers import (
|
8 |
+
load_tool,
|
9 |
+
ReactCodeAgent,
|
10 |
+
HfApiEngine,
|
11 |
+
stream_to_gradio,
|
12 |
+
)
|
13 |
+
from transformers.agents.search import DuckDuckGoSearchTool
|
14 |
|
15 |
logging.basicConfig(level=logging.INFO)
|
16 |
|
17 |
+
# Import tool from Hub
|
18 |
+
image_generation_tool = load_tool("m-ric/text-to-image")
|
19 |
+
|
20 |
+
llm_engine = HfApiEngine("Qwen/Qwen2.5-72B-Instruct")
|
21 |
+
|
22 |
+
search_tool = DuckDuckGoSearchTool()
|
23 |
+
|
24 |
+
# Initialize the agent with the image generation tool
|
25 |
+
agent = ReactCodeAgent(tools=[image_generation_tool], llm_engine=llm_engine, additional_authorized_imports=['requests', 'bs4'] , add_base_tools=True)
|
26 |
+
|
27 |
+
|
28 |
# Initializes your app with your bot token and socket mode handler
|
29 |
app = App(token=os.environ.get("SLACK_BOT_TOKEN"))
|
30 |
|