Skip to content

Instantly share code, notes, and snippets.

View duarteocarmo's full-sized avatar
🍓

Duarte OC duarteocarmo

🍓
View GitHub Profile

Base

For the given query including a meal description, calculate the amount of carbohydrates in grams. If the serving size of any item in the
meal is not specified, assume it is a single standard serving based on common nutritional guidelines (e.g., USDA).
Respond with a dictionary object containing the total carbohydrates in grams as follows:
{{"total_carbohydrates": total grams of carbohydrates for the serving}}
For the total carbohydrates, respond with just the numeric amount of carbohydrates without extra text. If you don't know the answer,
respond with:
{{"total_carbohydrates": -1}}.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duarteocarmo
duarteocarmo / opml_categorize.py
Created October 4, 2025 16:35
Categorize your OPML feed with an LLM
# requires-python = ">=3.13"
# /// script
# dependencies = [
# "pydantic",
# "feedparser",
# "tqdm",
# "litellm",
# ]
# ///
@duarteocarmo
duarteocarmo / gpt_grpo.py
Last active September 23, 2025 09:42
Uv script with minimal GRPO implementation
# /// script
# dependencies = [
# "transformers",
# "torch",
# "accelerate",
# "matplotlib",
# ]
# ///
# Notes: Mostly stolen from https://github.com/open-thought/tiny-grpo
# Run with uv run gpt_grpo.py
import streamlit as st
from litellm import completion, stream_chunk_builder
from loguru import logger
import json
import plotly.express as px
from enum import Enum
MODEL = "gpt-4o-mini"
import pandas
def remove_bad_cols(dataframe):
return df.drop(
labels=df.columns.difference(["passengerid", "price_paid"]), axis=1
)
def add_inflation_to_price(dataframe):
delivery-85367.icu
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object
refer: whois.nic.icu
domain: ICU
organisation: Shortdot SA
@duarteocarmo
duarteocarmo / corona_widget.js
Last active November 2, 2020 20:01
A coronavirus widget for your homescreen
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: user-md;
// change "country" to a value from https://coronavirus-19-api.herokuapp.com/countries/
// teste
const country = "Portugal"
const url = `https://coronavirus-19-api.herokuapp.com/countries/${country}`
const req = new Request(url)
const res = await req.loadJSON()
{
"embeddings": [
{
"tensorName": "My tensor",
"tensorShape": [
27378,
128
],
"tensorPath": "https://opera-nora-vos.dataverz.com/upload-json/upload/corona_128.tsv",
"metadataPath": "https://opera-nora-vos.dataverz.com/upload-json/upload/corona_128_metadata.tsv"