Spaces:
No application file
No application file
salehalmansour
commited on
Commit
•
0adca5e
1
Parent(s):
c11f1e4
Update app.py
Browse files
app.py
CHANGED
@@ -13,5 +13,25 @@ class CFG:
|
|
13 |
|
14 |
image_gen_model = StableDiffusionPipeline.from_pretrained(
|
15 |
CFG.image_gen_model_id, torch_dtype=torch.float32,
|
16 |
-
revision="fp16", use_auth_token='
|
17 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
image_gen_model = StableDiffusionPipeline.from_pretrained(
|
15 |
CFG.image_gen_model_id, torch_dtype=torch.float32,
|
16 |
+
revision="fp16", use_auth_token='hf_pxvzpoafqjfkELFKMLTESNpvmyvkTVuD01' , guidance_scale=9
|
17 |
+
)
|
18 |
+
|
19 |
+
apply = image_gen_model.to(CFG.device)
|
20 |
+
|
21 |
+
def generate_image(prompt):
|
22 |
+
image = apply(
|
23 |
+
prompt, num_inference_steps=CFG.image_gen_steps,
|
24 |
+
generator=CFG.generator ,
|
25 |
+
guidance_scale=CFG.image_gen_guidance_scale
|
26 |
+
).image[0]
|
27 |
+
image = image.resize(CFG.image_gen_size)
|
28 |
+
return image
|
29 |
+
)
|
30 |
+
|
31 |
+
|
32 |
+
title = "تصوَّر"
|
33 |
+
description = "أدخل نص نحولها لك صوره"
|
34 |
+
|
35 |
+
iface = gr.interface(fn=generate_image, inputs = "text", outputs = "image" , title= title , description=description)
|
36 |
+
iface.launch(
|
37 |
+
)
|