Spaces:
Runtime error
Runtime error
File size: 2,276 Bytes
cfccdc2 d77a781 596d353 d77a781 0006a92 586ddad cfccdc2 e6d1b4c fdb1186 0eaa580 c2305a3 36c3ba1 c2305a3 36c3ba1 c2305a3 b2f39c8 e6d1b4c b2f39c8 2370152 b2f39c8 2652bae fdb1186 dfa6c0a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import gradio as gr
import numpy as np
# from edict_functions import EDICT_editing
from PIL import Image
from utils import Endpoint, get_token
from io import BytesIO
import requests
def f(x):
return x
description = '*This demo is temporarily suspended for internal reasons* A gradio demo for [EDICT](https://arxiv.org/abs/2211.12446) (CVPR23)'
# description = gr.Markdown(description)
article = """
### Prompting Style
As with many text-to-image methods, the prompting style of EDICT can make a big difference. When in doubt, experiment! Some guidance:
* Parallel *Original Description* and *Edit Description* construction as much as possible. Inserting/editing single words often is enough to affect a change while maintaining a lot of the original structure
* Words that will affect the entire setting (e.g. "A photo of " vs. "A painting of") can make a big difference. Playing around with them can help a lot
### Parameters
Both `edit_strength` and `guidance_scale` have similar properties qualitatively: the higher the value the more the image will change. We suggest
* Increasing/decreasing `edit_strength` first, particularly to alter/preserve more of the original structure/content
* Then changing `guidance_scale` to make the change in the edited region more or less pronounced.
Usually we find changing `edit_strength` to be enough, but feel free to play around (and report any interesting results)!
### Misc.
Having difficulty coming up with a caption? Try [BLIP](https://huggingface.co/spaces/Salesforce/BLIP2) to automatically generate one!
As with most StableDiffusion approaches, faces/text are often problematic to render, especially if they're small. Having these in the foreground will help keep them cleaner.
A returned black image means that the [Safety Checker](https://huggingface.co/CompVis/stable-diffusion-safety-checker) triggered on the photo. This happens in odd cases sometimes (it often rejects
the huggingface logo or variations), but we need to keep it in for obvious reasons.
"""
iface = gr.Interface(fn=f,
inputs=['image'],
# examples = examples,
outputs="image",
description=description,
article=article)
iface.launch()
|