Update app.py
Browse files
app.py
CHANGED
|
@@ -6,15 +6,11 @@ model_id = "LiquidAI/LFM2-350M-Extract"
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 8 |
|
| 9 |
-
system_prompt = """
|
| 10 |
-
Return data as a JSON object. Missing data should be omitted.
|
| 11 |
-
|
| 12 |
-
Schema:
|
| 13 |
- orders: list of objects:
|
| 14 |
- product: Product name
|
| 15 |
- price: Price as number without $ sign
|
| 16 |
-
- quantity: Number of items as integer
|
| 17 |
-
"""
|
| 18 |
|
| 19 |
def clean_result(parsed):
|
| 20 |
for order in parsed.get("orders", []):
|
|
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 8 |
|
| 9 |
+
system_prompt = """Return data as a JSON object with the following schema:
|
|
|
|
|
|
|
|
|
|
| 10 |
- orders: list of objects:
|
| 11 |
- product: Product name
|
| 12 |
- price: Price as number without $ sign
|
| 13 |
+
- quantity: Number of items as integer"""
|
|
|
|
| 14 |
|
| 15 |
def clean_result(parsed):
|
| 16 |
for order in parsed.get("orders", []):
|