|
import gradio as gr |
|
from huggingface_hub import PyTorchModelHubMixin |
|
import torch |
|
import matplotlib.pyplot as plt |
|
import torchvision |
|
from networks_fastgan import MyGenerator |
|
import click |
|
import PIL |
|
from image_generator import generate_images |
|
|
|
def image_generation(model, number_of_images=1): |
|
img = generate_images(model) |
|
|
|
return img |
|
if __name__ == "__main__": |
|
description = "This is a web demo of a projected GAN trained on ~30 pictures that contain houses that were painted by my dear friend Hana Hanak, check out the results for yourself. the abstract expressionism and color field models were initially trained on pictures from their perspective art directions and then transfer learned to Hana's houses " |
|
inputs = gr.inputs.Radio(["Hana Hanak houses", "Hana Hanak houses - abstract expressionism", "Hana Hanak houses - color field"]) |
|
outputs = gr.outputs.Image(label="Generated Image", type="pil") |
|
|
|
title = "Projected GAN for painting generation v0.2" |
|
article = "<p style='text-align: center'><a href='https://github.com/autonomousvision/projected_gan'>Official projected GAN github repo + paper</a></p>" |
|
|
|
|
|
|
|
gr.Interface(image_generation, inputs, outputs, title=title, article = article, description = description, |
|
analytics_enabled=False).launch(debug=True) |
|
|
|
app, local_url, share_url = iface.launch() |
|
|
|
|