File size: 558 Bytes
bab4aa8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

import asyncio
import os
from dotenv import load_dotenv

load_dotenv()

from app.services.quantity_normalizer_service import QuantityNormalizerService

async def main():
    async with QuantityNormalizerService(
        api_key=os.getenv("USDA_API_KEY")
    ) as q:

        result = await q.normalize_ingredient({
            "name": "Onion",
            "quantity": "1",
            "unit": "medium"
        })

        print(result)

asyncio.run(main())