Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,7 @@ from langchain.agents import initialize_agent, Tool
|
|
| 34 |
from langchain_community.llms import HuggingFaceHub
|
| 35 |
#from langchain_community.tools import PythonREPL
|
| 36 |
|
|
|
|
| 37 |
#from langchain_community.tools.python.tool import PythonREPLTool
|
| 38 |
#from langchain_community.tools.python_repl import PythonREPLTool
|
| 39 |
from langchain_experimental.tools.python.tool import PythonREPLTool
|
|
@@ -117,7 +118,12 @@ image_tool = Tool(
|
|
| 117 |
|
| 118 |
repl_tool = PythonREPLTool()
|
| 119 |
hf_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 120 |
-
llm = HuggingFaceHub(repo_id="google/flan-t5-xl", huggingfacehub_api_token=hf_token,model_kwargs={"temperature": 0.2, "max_length": 1024})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
tools = [wiki_tool, youtube_tool, audio_tool, excel_tool, image_tool, repl_tool]
|
| 123 |
agent_instance = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
|
|
|
| 34 |
from langchain_community.llms import HuggingFaceHub
|
| 35 |
#from langchain_community.tools import PythonREPL
|
| 36 |
|
| 37 |
+
from langchain_huggingface import HuggingFaceEndpoint
|
| 38 |
#from langchain_community.tools.python.tool import PythonREPLTool
|
| 39 |
#from langchain_community.tools.python_repl import PythonREPLTool
|
| 40 |
from langchain_experimental.tools.python.tool import PythonREPLTool
|
|
|
|
| 118 |
|
| 119 |
repl_tool = PythonREPLTool()
|
| 120 |
hf_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 121 |
+
#llm = HuggingFaceHub(repo_id="google/flan-t5-xl", huggingfacehub_api_token=hf_token,model_kwargs={"temperature": 0.2, "max_length": 1024})
|
| 122 |
+
llm = HuggingFaceEndpoint(
|
| 123 |
+
repo_id="google/flan-t5-xl",
|
| 124 |
+
huggingfacehub_api_token=hf_token,
|
| 125 |
+
model_kwargs={"temperature": 0.2, "max_length": 1024}
|
| 126 |
+
)
|
| 127 |
|
| 128 |
tools = [wiki_tool, youtube_tool, audio_tool, excel_tool, image_tool, repl_tool]
|
| 129 |
agent_instance = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|