Spaces:
Runtime error
Runtime error
update
Browse files- llm/inference.py +4 -2
llm/inference.py
CHANGED
|
@@ -14,6 +14,7 @@ client = InferenceClient(api_key=api_key)
|
|
| 14 |
|
| 15 |
|
| 16 |
def extract_product_info(text):
|
|
|
|
| 17 |
# Initialize result dictionary
|
| 18 |
result = {"brand": None, "model": None, "description": None, "price": None}
|
| 19 |
|
|
@@ -51,7 +52,7 @@ def extract_product_info(text):
|
|
| 51 |
|
| 52 |
# Combine the remaining parts as description
|
| 53 |
result["description"] = " ".join(description_parts)
|
| 54 |
-
|
| 55 |
return result
|
| 56 |
|
| 57 |
|
|
@@ -97,7 +98,8 @@ def get_name(url, object):
|
|
| 97 |
llm_result = completion.choices[0].message['content']
|
| 98 |
print(llm_result)
|
| 99 |
print(f'\n\nThat is the output')
|
| 100 |
-
|
|
|
|
| 101 |
result = extract_product_info(llm_result)
|
| 102 |
print(f'\n\nResult brand and price:{result}')
|
| 103 |
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
def extract_product_info(text):
|
| 17 |
+
print(f'Extract function called!')
|
| 18 |
# Initialize result dictionary
|
| 19 |
result = {"brand": None, "model": None, "description": None, "price": None}
|
| 20 |
|
|
|
|
| 52 |
|
| 53 |
# Combine the remaining parts as description
|
| 54 |
result["description"] = " ".join(description_parts)
|
| 55 |
+
print(f'extract function returned:\n{result}')
|
| 56 |
return result
|
| 57 |
|
| 58 |
|
|
|
|
| 98 |
llm_result = completion.choices[0].message['content']
|
| 99 |
print(llm_result)
|
| 100 |
print(f'\n\nThat is the output')
|
| 101 |
+
|
| 102 |
+
print(f'Extracting from the output now, function calling')
|
| 103 |
result = extract_product_info(llm_result)
|
| 104 |
print(f'\n\nResult brand and price:{result}')
|
| 105 |
|