Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,13 +8,14 @@ dataset = load_dataset("bprateek/amazon_product_description", revision="main", t
|
|
| 8 |
|
| 9 |
|
| 10 |
@tool
|
| 11 |
-
def
|
| 12 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 13 |
-
"""This is a tool which look on a dataset
|
| 14 |
Args:
|
| 15 |
arg1: the category of product
|
| 16 |
"""
|
| 17 |
#filter_dataset = set(dataset['train']['Category'])
|
|
|
|
| 18 |
responses = dataset[dataset['Product Name'].str.contains(arg1)]
|
| 19 |
print(responses)
|
| 20 |
#filter_dataset_min = filter_dataset['Selling Price'].min()
|
|
@@ -25,8 +26,8 @@ def predict_price_tool(arg1:str)-> float: #it's import to specify the return typ
|
|
| 25 |
|
| 26 |
#Agent Example
|
| 27 |
model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", token=os.getenv('Testing'))
|
| 28 |
-
agent = CodeAgent(tools=[
|
| 29 |
-
agent.run("Electronics")
|
| 30 |
|
| 31 |
# Access HF Hub
|
| 32 |
#from huggingface_hub import list_models
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
@tool
|
| 11 |
+
def get_price_tool(arg1:str)-> float: #it's import to specify the return type
|
| 12 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 13 |
+
"""This is a tool which look on a dataset and filter for products and their various atteibutes like prices description
|
| 14 |
Args:
|
| 15 |
arg1: the category of product
|
| 16 |
"""
|
| 17 |
#filter_dataset = set(dataset['train']['Category'])
|
| 18 |
+
print(arg1)
|
| 19 |
responses = dataset[dataset['Product Name'].str.contains(arg1)]
|
| 20 |
print(responses)
|
| 21 |
#filter_dataset_min = filter_dataset['Selling Price'].min()
|
|
|
|
| 26 |
|
| 27 |
#Agent Example
|
| 28 |
model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", token=os.getenv('Testing'))
|
| 29 |
+
agent = CodeAgent(tools=[get_price_tool], model=model)
|
| 30 |
+
agent.run("Can you dispay prices of all Electronics products in a table")
|
| 31 |
|
| 32 |
# Access HF Hub
|
| 33 |
#from huggingface_hub import list_models
|