Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ class ModelActor:
|
|
| 17 |
"""
|
| 18 |
self.model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
| 19 |
|
| 20 |
-
def generate_image(self, prompt, prompt_name):
|
| 21 |
"""
|
| 22 |
Generates an image based on the provided prompt.
|
| 23 |
Parameters:
|
|
@@ -29,7 +29,7 @@ class ModelActor:
|
|
| 29 |
start_time = time.time()
|
| 30 |
process_id = os.getpid()
|
| 31 |
try:
|
| 32 |
-
output = self.model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0)
|
| 33 |
if isinstance(output.images, list) and len(output.images) > 0:
|
| 34 |
image = output.images[0]
|
| 35 |
buffered = BytesIO()
|
|
@@ -93,4 +93,4 @@ gradio_interface = gr.Interface(
|
|
| 93 |
)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|
| 96 |
-
gradio_interface.launch()
|
|
|
|
| 17 |
"""
|
| 18 |
self.model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
| 19 |
|
| 20 |
+
async def generate_image(self, prompt, prompt_name):
|
| 21 |
"""
|
| 22 |
Generates an image based on the provided prompt.
|
| 23 |
Parameters:
|
|
|
|
| 29 |
start_time = time.time()
|
| 30 |
process_id = os.getpid()
|
| 31 |
try:
|
| 32 |
+
output = await self.model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0)
|
| 33 |
if isinstance(output.images, list) and len(output.images) > 0:
|
| 34 |
image = output.images[0]
|
| 35 |
buffered = BytesIO()
|
|
|
|
| 93 |
)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|
| 96 |
+
gradio_interface.launch()
|