Skip to content

Instantly share code, notes, and snippets.

View nathansutton's full-sized avatar

Nathan Sutton nathansutton

View GitHub Profile
from PIL import Image
from transformers import BlipForConditionalGeneration, BlipProcessor
# read in the model
processor = BlipProcessor.from_pretrained("nathansutton/generate-cxr")
model = BlipForConditionalGeneration.from_pretrained("nathansutton/generate-cxr")
# your data
my_image = 'my-chest-x-ray.jpg'
my_indication = 'RLL crackles, eval for pneumonia'
flyway_1 | Database: jdbc:postgresql://postgres:5432/athena (PostgreSQL 12.4)
flyway_1 | Successfully validated 54 migrations (execution time 00:00.320s)
flyway_1 | Creating Schema History table "public"."flyway_schema_history" ...
flyway_1 | Current version of schema "public": << Empty Schema >>
flyway_1 | Migrating schema "public" to version 0000 - relationship
flyway_1 | Migrating schema "public" to version 0001 - vocabulary
flyway_1 | Migrating schema "public" to version 0002 - concept ancestor
flyway_1 | Migrating schema "public" to version 0003 - concept
flyway_1 | Migrating schema "public" to version 0004 - concept relationship
flyway_1 | Migrating schema "public" to version 0005 - concept class
docker-compose down
docker-compose up
{sql connection=connection}
create view vw_model as
select
visit_occurrence_id
,person_id
,1.0 - 1.0 / (1.0 + EXP((-2.95983732216539) + (readmit_030_flg * 0.477723271743372) + (readmit_360_flg * 0.531143494501182) + (icd_history_518 * 0.651130360976662))) as risk
from vw_baseline
@nathansutton
nathansutton / r_version
Last active September 15, 2021 23:56
translate an h2o model into sql
{r}
translate <- function(fit){
### return the sql translation of a h2o.glm model ###
# safety
stopifnot(class(fit) %in% c("H2OBinomialModel","H2ORegressionModel"))
stopifnot(.hasSlot(fit, "algorithm"))
stopifnot(.hasSlot(fit, "model"))
@nathansutton
nathansutton / python_version
Last active March 6, 2019 21:31
translate an h2o model in sql
{python}
def translate (fit) :
"""return the sql translation of a H2OGeneralizedLinearEstimator"""
# pandas dependency
try:
import pandas.DataFrame
except ImportError: