Spaces:
Paused
Paused
Update app.py
Browse files15 unmodified lines1617181920213 unmodified lines25262728293084 unmodified lines1151161171181191201211221231246 unmodified lines13113213313413513613713813914015 unmodified linesfrom PIL import Imagefrom huggingface_hub import hf_hub_downloadckpt = hf_hub_download(repo_id="lambdalabs/image-mixer", filename="image-mixer-pruned.ckpt", cache_dir="/data/.cache")config = hf_hub_download(repo_id="lambdalabs/image-mixer", filename="image-mixer-config.yaml", cache_dir="/data/.cache")3 unmodified linesmodel = model.to(device).half()clip_model, preprocess = clip.load("ViT-L/14", device=device)n_inputs = 584 unmodified linestorch.cuda.empty_cache()return ims[0]import gradiodef boutsify(person):inputs = ["Image", "Image", "Text/URL", "Image", "Nothing","","","flowers","","",6 unmodified lines3.0, 1, 0, 40,]return run(inputs)gradio_interface = gradio.Interface(fn=my_inference_function,inputs="image",outputs="image",title="Boutsify images",15 unmodified lines1617181920212223243 unmodified lines282930313233343584 unmodified lines1201211221231241251261271281291301311321331341356 unmodified lines14214314414514614714814915015115 unmodified linesfrom PIL import Imagefrom fastai.vision.all import *import skimagefrom huggingface_hub import hf_hub_downloadckpt = hf_hub_download(repo_id="lambdalabs/image-mixer", filename="image-mixer-pruned.ckpt", cache_dir="/data/.cache")config = hf_hub_download(repo_id="lambdalabs/image-mixer", filename="image-mixer-config.yaml", cache_dir="/data/.cache")3 unmodified linesmodel = model.to(device).half()clip_model, preprocess = clip.load("ViT-L/14", device=device)gender_learn = load_learner('model.pkl')gender_labels = gender_learn.dls.vocabn_inputs = 584 unmodified linestorch.cuda.empty_cache()return ims[0]def guess_gender(img):pred,pred_idx,probs = gender_learn.predict(img)return {gender_labels[i]: float(probs[i]) for i in range(len(gender_labels))}import gradiodef boutsify(person):print(guess_gender(person))inputs = ["Image", "Image", "Text/URL", "Image", "Nothing","","","flowers","","",6 unmodified lines3.0, 1, 0, 40,]return run_image_mixer(inputs)gradio_interface = gradio.Interface(fn=boutsify,inputs="image",outputs="image",title="Boutsify images",
app.py+13-2