Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from diffusers import StableDiffusionPipeline
|
|
@@ -35,6 +36,8 @@ image_gen = image_gen.to(device)
|
|
| 35 |
# Load the image-to-text pipeline
|
| 36 |
caption_image = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large", device=device)
|
| 37 |
|
|
|
|
|
|
|
| 38 |
def generate_image_from_caption(image, num_inference_steps=50, guidance_scale=7.5):
|
| 39 |
# Generate the caption
|
| 40 |
caption = caption_image(image)[0]['generated_text']
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from diffusers import StableDiffusionPipeline
|
|
|
|
| 36 |
# Load the image-to-text pipeline
|
| 37 |
caption_image = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large", device=device)
|
| 38 |
|
| 39 |
+
|
| 40 |
+
@spaces.GPU(enable_queue=True)
|
| 41 |
def generate_image_from_caption(image, num_inference_steps=50, guidance_scale=7.5):
|
| 42 |
# Generate the caption
|
| 43 |
caption = caption_image(image)[0]['generated_text']
|