Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
|
|
|
| 3 |
|
| 4 |
# Diffusers
|
| 5 |
from diffusers import (
|
|
@@ -20,6 +21,9 @@ import flax
|
|
| 20 |
from flax.jax_utils import replicate
|
| 21 |
from flax.training.common_utils import shard
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def create_key(seed=0):
|
| 25 |
return jax.random.PRNGKey(seed)
|
|
@@ -74,7 +78,10 @@ def infer(prompts, negative_prompts, image):
|
|
| 74 |
|
| 75 |
|
| 76 |
title = "ControlNet + Stable Diffusion for Battlemaps"
|
| 77 |
-
description = "Sketch your game battlemap and add some prompts to let the magic happen 🪄.
|
|
|
|
|
|
|
|
|
|
| 78 |
# you need to pass inputs and outputs according to inference function
|
| 79 |
gr.Interface(
|
| 80 |
fn=infer,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
# Diffusers
|
| 6 |
from diffusers import (
|
|
|
|
| 21 |
from flax.jax_utils import replicate
|
| 22 |
from flax.training.common_utils import shard
|
| 23 |
|
| 24 |
+
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false"
|
| 25 |
+
os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"]=".XX"
|
| 26 |
+
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"]="platform"
|
| 27 |
|
| 28 |
def create_key(seed=0):
|
| 29 |
return jax.random.PRNGKey(seed)
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
title = "ControlNet + Stable Diffusion for Battlemaps"
|
| 81 |
+
description = """Sketch your game battlemap and add some prompts to let the magic happen 🪄.
|
| 82 |
+
Pretrained on battlemaps images.
|
| 83 |
+
By Orgrim, Karm and Robin "
|
| 84 |
+
"""
|
| 85 |
# you need to pass inputs and outputs according to inference function
|
| 86 |
gr.Interface(
|
| 87 |
fn=infer,
|