Spaces:
Runtime error
Runtime error
import gradio as gr | |
from gradio.mix import Parallel, Series | |
description = "BigGAN text-to-image demo." | |
title = "BigGAN ImageNet" | |
Gans=["biggan-deep-128", "biggan-deep-256", "biggan-deep-512"] | |
model_names={"vqgan_imagenet_f16_16384": 'ImageNet 16384',"vqgan_imagenet_f16_1024":"ImageNet 1024", 'vqgan_openimages_f16_8192':'OpenImages 8912',"wikiart_1024":"WikiArt 1024", "wikiart_16384":"WikiArt 16384", "coco":"COCO-Stuff", "faceshq":"FacesHQ", "sflckr":"S-FLCKR"} | |
import os | |
import torch | |
from PIL import Image | |
from torchvision import transforms | |
# === SEMI-WEAKLY SUPERVISED MODELSP RETRAINED WITH 940 HASHTAGGED PUBLIC CONTENT === | |
model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnet18_swsl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnet50_swsl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext50_32x4d_swsl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x4d_swsl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x8d_swsl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x16d_swsl') | |
# ================= SEMI-SUPERVISED MODELS PRETRAINED WITH YFCC100M ================== | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnet18_ssl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnet50_ssl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext50_32x4d_ssl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x4d_ssl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x8d_ssl') | |
# model = torch.hub.load('facebookresearch/semi-supervised-ImageNet1K-models', 'resnext101_32x16d_ssl') | |
io1 = gr.Interface.load('huggingface/osanseviero/BigGAN-deep-128') | |
io2 = gr.Interface.load('huggingface/osanseviero/BigGAN-deep-128') | |
#io3 = gr.Interface.load('vqgan_imagenet_f16_16384') | |
io3 = gr.Interface.load(model) | |
#io3 = gr.Interface.load("huggingface/emilyalsentzer/Bio_Discharge_Summary_BERT") | |
#io3 = gr.Interface.load("huggingface/google/pegasus-pubmed") | |
#io3 = gr.Interface.load("huggingface/tennessejoyce/titlewave-t5-base") | |
# = Parallel(io1, io2, io3, | |
interface = Parallel(io1,io2,io3, | |
description=description, | |
title = title, | |
examples=[ | |
["lighthouse"], | |
["eyeglasses"], | |
["stool"], | |
["window"], | |
["hand"], | |
["dice"], | |
["cloud"], | |
["gate"], | |
["cat"], | |
["toes"] | |
] | |
) | |
interface.launch() |