Spaces:
Sleeping
Sleeping
Avijit Ghosh
commited on
Commit
·
64fe77f
1
Parent(s):
1b1e359
removed wrappers
Browse files
app.py
CHANGED
|
@@ -15,17 +15,12 @@ import numpy as np
|
|
| 15 |
from matplotlib.colors import hex2color
|
| 16 |
|
| 17 |
|
| 18 |
-
pipeline_text2image =
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
"stabilityai/sdxl-turbo",
|
| 25 |
-
torch_dtype=torch.float16,
|
| 26 |
-
variant="fp16",
|
| 27 |
-
)
|
| 28 |
-
pipeline_text2image = pipeline_text2image.to("cuda")
|
| 29 |
|
| 30 |
|
| 31 |
@spaces.GPU
|
|
@@ -37,17 +32,12 @@ def getimgen(prompt):
|
|
| 37 |
num_inference_steps=2
|
| 38 |
).images[0]
|
| 39 |
|
| 40 |
-
blip_processor = None
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
blip_model = BlipForConditionalGeneration.from_pretrained(
|
| 48 |
-
"Salesforce/blip-image-captioning-large",
|
| 49 |
-
torch_dtype=torch.float16
|
| 50 |
-
).to("cuda")
|
| 51 |
|
| 52 |
|
| 53 |
@spaces.GPU
|
|
@@ -143,9 +133,6 @@ with gr.Blocks(title = "Skin Tone and Gender bias in SDXL Demo - Inference API")
|
|
| 143 |
|
| 144 |
gr.Markdown("# Skin Tone and Gender bias in SDXL Demo")
|
| 145 |
|
| 146 |
-
loadpipeline()
|
| 147 |
-
loadblip()
|
| 148 |
-
|
| 149 |
prompt = gr.Textbox(label="Enter the Prompt")
|
| 150 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery",
|
| 151 |
columns=[5], rows=[2], object_fit="contain", height="auto")
|
|
|
|
| 15 |
from matplotlib.colors import hex2color
|
| 16 |
|
| 17 |
|
| 18 |
+
pipeline_text2image = AutoPipelineForText2Image.from_pretrained(
|
| 19 |
+
"stabilityai/sdxl-turbo",
|
| 20 |
+
torch_dtype=torch.float16,
|
| 21 |
+
variant="fp16",
|
| 22 |
+
)
|
| 23 |
+
pipeline_text2image = pipeline_text2image.to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
@spaces.GPU
|
|
|
|
| 32 |
num_inference_steps=2
|
| 33 |
).images[0]
|
| 34 |
|
|
|
|
| 35 |
|
| 36 |
+
blip_processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 37 |
+
blip_model = BlipForConditionalGeneration.from_pretrained(
|
| 38 |
+
"Salesforce/blip-image-captioning-large",
|
| 39 |
+
torch_dtype=torch.float16
|
| 40 |
+
).to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
@spaces.GPU
|
|
|
|
| 133 |
|
| 134 |
gr.Markdown("# Skin Tone and Gender bias in SDXL Demo")
|
| 135 |
|
|
|
|
|
|
|
|
|
|
| 136 |
prompt = gr.Textbox(label="Enter the Prompt")
|
| 137 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery",
|
| 138 |
columns=[5], rows=[2], object_fit="contain", height="auto")
|