Spaces:
Sleeping
Sleeping
Update app.py
Browse files43 unmodified lines444546474849474849505152535443 unmodified lines if response.status_code == 200: data = response.json() if data['count'] > 0: product = data['products'][0] calories = product.get('nutriments', {}).get('energy-kcal_100g', 'No data') return calories for product in data['products']: if 'energy-kcal_100g' in product.get('nutriments', {}): calories = product['nutriments']['energy-kcal_100g'] return f"{calories} kcal per 100g" return 'No data found' else: return 'No data found' else:app.py+5-3