Skip to content

Instantly share code, notes, and snippets.

View yonromai's full-sized avatar

Romain Yon yonromai

  • Indie, Ex Spotify
  • San Diego
View GitHub Profile
@yonromai
yonromai / server.py
Last active November 8, 2024 02:16
Add batch support to `nemoguardrails/nemoguardrails/library/factchecking/align_score/server.py`
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@yonromai
yonromai / tutorial_pytorch.py
Last active August 3, 2023 02:08
Playing with Ray Serve
import logging
from io import BytesIO
from typing import Dict
import torch
from PIL import Image
from ray import serve
from starlette.requests import Request
from torchvision import transforms
from torchvision.models import resnet18
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Sotheby's
#
from click import Context
from invoke import run, task
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Iterable, Set
@yonromai
yonromai / gcloud_introspec.md
Created May 21, 2020 00:35
Gcloud Introspection

Gcloud Introspection

Json file

Entrypoint: In gcloud.py:

if __name__ == "__main__":
    sys.argv.extend(["endpoints", "services", "deploy", "/Users/romain/dev/alpine/spec.json", "--project=sothebys-data"])
 main()
@yonromai
yonromai / README.md
Last active April 17, 2020 15:08
Major pythonistic setups.

Pythonistic setups

Here are setups of 5 major pythonistic projects (somewhat arbitrary).

Useful to see what are the most canonical setups and configurations.

Project setup

black mypy pipenv pytest requests
pipenv

[Lunch and Learn] About writing testable code

Intro:

¿ What makes code easy vs. hard to test ?

Agenda

  • Motivations
  • Global State
@yonromai
yonromai / idea
Created March 14, 2016 21:07 — forked from chrisdarroch/idea
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`