Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import os
|
| 3 |
import re
|
| 4 |
-
#from tempfile import NamedTemporaryFile
|
| 5 |
-
import numpy as np
|
| 6 |
import spaces
|
| 7 |
import random
|
| 8 |
import string
|
| 9 |
-
from diffusers import AutoPipelineForText2Image
|
| 10 |
import torch
|
| 11 |
-
from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
|
| 12 |
import requests
|
|
|
|
|
|
|
| 13 |
from lxml.html import fromstring
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
pool = ProcessPoolExecutor(
|
| 16 |
-
pool.__enter__()
|
| 17 |
|
| 18 |
#model_id = "runwayml/stable-diffusion-v1-5"
|
| 19 |
#model_id = "kandinsky-community/kandinsky-3"
|
|
@@ -85,15 +85,15 @@ def generate_random_string(length):
|
|
| 85 |
characters = string.ascii_letters + string.digits
|
| 86 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 87 |
|
| 88 |
-
@spaces.GPU(duration=120
|
| 89 |
def Piper(_do,_dont):
|
| 90 |
return pipe(
|
| 91 |
_do,
|
| 92 |
height=512,
|
| 93 |
-
width=1024
|
| 94 |
negative_prompt=_dont,
|
| 95 |
-
num_inference_steps=400
|
| 96 |
-
guidance_scale=10
|
| 97 |
)
|
| 98 |
|
| 99 |
def infer(prompt,prompt2):
|
|
@@ -132,7 +132,7 @@ footer {
|
|
| 132 |
max-width: 15cm !important;
|
| 133 |
}
|
| 134 |
#image-container {
|
| 135 |
-
aspect-ratio:
|
| 136 |
}
|
| 137 |
.dropdown-arrow {
|
| 138 |
display: none !important;
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
|
|
|
|
|
|
| 3 |
import spaces
|
| 4 |
import random
|
| 5 |
import string
|
|
|
|
| 6 |
import torch
|
|
|
|
| 7 |
import requests
|
| 8 |
+
import gradio as gr
|
| 9 |
+
import numpy as np
|
| 10 |
from lxml.html import fromstring
|
| 11 |
+
from diffusers import AutoPipelineForText2Image
|
| 12 |
+
#from tempfile import NamedTemporaryFile
|
| 13 |
+
#from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
|
| 14 |
|
| 15 |
+
#pool = ProcessPoolExecutor(1000)
|
| 16 |
+
#pool.__enter__()
|
| 17 |
|
| 18 |
#model_id = "runwayml/stable-diffusion-v1-5"
|
| 19 |
#model_id = "kandinsky-community/kandinsky-3"
|
|
|
|
| 85 |
characters = string.ascii_letters + string.digits
|
| 86 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 87 |
|
| 88 |
+
@spaces.GPU(duration=20) # 120
|
| 89 |
def Piper(_do,_dont):
|
| 90 |
return pipe(
|
| 91 |
_do,
|
| 92 |
height=512,
|
| 93 |
+
width=768, # 1024
|
| 94 |
negative_prompt=_dont,
|
| 95 |
+
num_inference_steps=25, # 400
|
| 96 |
+
guidance_scale=1.1 # 10
|
| 97 |
)
|
| 98 |
|
| 99 |
def infer(prompt,prompt2):
|
|
|
|
| 132 |
max-width: 15cm !important;
|
| 133 |
}
|
| 134 |
#image-container {
|
| 135 |
+
aspect-ratio: 768 / 512 !important;
|
| 136 |
}
|
| 137 |
.dropdown-arrow {
|
| 138 |
display: none !important;
|