Spaces:
Runtime error
Runtime error
Commit
Β·
d659810
1
Parent(s):
8701e7e
Updated app.py line 185
Browse files
app.py
CHANGED
@@ -183,17 +183,8 @@ openai.api_key = os.environ['OPENAI_KEY']
|
|
183 |
PROMPT = "colorful portrait 25 year bespectacled woman with long, curly skyblue hair and bright green eyes. She has a small, upturned nose and a freckled complexion. She is approximately 5'5 tall and has a thin build"
|
184 |
def generate(PROMPT,model):
|
185 |
# PROMPT = "An eco-friendly computer from the 90s in the style of vaporwave""Dall-E","StableDiffusion"
|
186 |
-
|
187 |
-
|
188 |
-
prompt=PROMPT,
|
189 |
-
n=1,
|
190 |
-
size="256x256",
|
191 |
-
)
|
192 |
-
x = response["data"][0]["url"]
|
193 |
-
urllib.request.urlretrieve(x,"file")
|
194 |
-
img = Image.open("file")
|
195 |
-
else:
|
196 |
-
img = generate_stability(PROMPT)
|
197 |
return np.asarray(img)
|
198 |
|
199 |
|
@@ -201,12 +192,7 @@ def generate(PROMPT,model):
|
|
201 |
API_ENDPOINT = "https://api.imgbb.com/1/upload"
|
202 |
API_KEY = "51e7720f96af8eb5179e772e443c0c1e"
|
203 |
|
204 |
-
# path_raw = input("Enter the image path: ")
|
205 |
-
# path = Path(path_raw)
|
206 |
-
# path = path_raw.replace("\\", "/")
|
207 |
|
208 |
-
# def imgLink(path):
|
209 |
-
# path = Path("/content/drive/MyDrive/Salz/dannydevito.png")
|
210 |
def imgLink(image):
|
211 |
pil_image = image.convert('RGB')
|
212 |
open_cv_image = np.array(pil_image)
|
@@ -524,10 +510,8 @@ home""")
|
|
524 |
abtn.click(generate_prompt, inputs=[text1_1,text1_2,text1_3,text1_4], outputs=text2)
|
525 |
with gr.Accordion("Generate MugShot",open=False):
|
526 |
gr.Markdown("**Generate MugShot from the input prompt using Dall-E**")
|
527 |
-
gr.Markdown("**Use
|
528 |
-
model = gr.Radio(["StableDiffusion"])
|
529 |
-
print(dir(model))
|
530 |
-
#with open('/content/logging.log',mode='a') as log_f: log_f.write(f'{datetime.now()} Using model for General Mugshot: {model.value}'+'\n')
|
531 |
with gr.Row():
|
532 |
with gr.Column():
|
533 |
# seed = gr.Text(label="Input Phrase")
|
@@ -536,7 +520,7 @@ home""")
|
|
536 |
# seed = gr.Text(label="Input Phrase")
|
537 |
im1 = gr.Image()
|
538 |
bbtn = gr.Button("Image from description")
|
539 |
-
bbtn.click(generate, inputs=[text3
|
540 |
|
541 |
with gr.Accordion("Image from Sketch",open=False):
|
542 |
gr.Markdown("**Get Enhanced Image from sketch and desired input promt using StableDiffusion**")
|
|
|
183 |
PROMPT = "colorful portrait 25 year bespectacled woman with long, curly skyblue hair and bright green eyes. She has a small, upturned nose and a freckled complexion. She is approximately 5'5 tall and has a thin build"
|
184 |
def generate(PROMPT,model):
|
185 |
# PROMPT = "An eco-friendly computer from the 90s in the style of vaporwave""Dall-E","StableDiffusion"
|
186 |
+
|
187 |
+
img = generate_stability(PROMPT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
return np.asarray(img)
|
189 |
|
190 |
|
|
|
192 |
API_ENDPOINT = "https://api.imgbb.com/1/upload"
|
193 |
API_KEY = "51e7720f96af8eb5179e772e443c0c1e"
|
194 |
|
|
|
|
|
|
|
195 |
|
|
|
|
|
196 |
def imgLink(image):
|
197 |
pil_image = image.convert('RGB')
|
198 |
open_cv_image = np.array(pil_image)
|
|
|
510 |
abtn.click(generate_prompt, inputs=[text1_1,text1_2,text1_3,text1_4], outputs=text2)
|
511 |
with gr.Accordion("Generate MugShot",open=False):
|
512 |
gr.Markdown("**Generate MugShot from the input prompt using Dall-E**")
|
513 |
+
gr.Markdown("**Use StableDiffusion Image Generation for text to image**")
|
514 |
+
# model = gr.Radio(["StableDiffusion"])
|
|
|
|
|
515 |
with gr.Row():
|
516 |
with gr.Column():
|
517 |
# seed = gr.Text(label="Input Phrase")
|
|
|
520 |
# seed = gr.Text(label="Input Phrase")
|
521 |
im1 = gr.Image()
|
522 |
bbtn = gr.Button("Image from description")
|
523 |
+
bbtn.click(generate, inputs=[text3], outputs=im1)
|
524 |
|
525 |
with gr.Accordion("Image from Sketch",open=False):
|
526 |
gr.Markdown("**Get Enhanced Image from sketch and desired input promt using StableDiffusion**")
|