Spaces:
Sleeping
Sleeping
Add GPU to image caption generation
Browse files
app.py
CHANGED
|
@@ -54,6 +54,8 @@ def base64_to_pil(img_base64):
|
|
| 54 |
pil_image = Image.open(byte_stream)
|
| 55 |
return pil_image
|
| 56 |
|
|
|
|
|
|
|
| 57 |
def captioner(image):
|
| 58 |
#base64_image = image_to_base64_str(image)
|
| 59 |
# The BLIP model expects a PIL image directly
|
|
@@ -62,7 +64,7 @@ def captioner(image):
|
|
| 62 |
|
| 63 |
return result[0]['generated_text']
|
| 64 |
|
| 65 |
-
#
|
| 66 |
@spaces.GPU # Designed to be effect-free in non-ZeroGPU environments, ensuring compatibility across different setups.
|
| 67 |
def generate(prompt, steps):
|
| 68 |
# Generate image with Stable Diffusion
|
|
|
|
| 54 |
pil_image = Image.open(byte_stream)
|
| 55 |
return pil_image
|
| 56 |
|
| 57 |
+
# Caption generate function
|
| 58 |
+
@spaces.GPU # Designed to be effect-free in non-ZeroGPU environments, ensuring compatibility across different setups.
|
| 59 |
def captioner(image):
|
| 60 |
#base64_image = image_to_base64_str(image)
|
| 61 |
# The BLIP model expects a PIL image directly
|
|
|
|
| 64 |
|
| 65 |
return result[0]['generated_text']
|
| 66 |
|
| 67 |
+
# Image generate function
|
| 68 |
@spaces.GPU # Designed to be effect-free in non-ZeroGPU environments, ensuring compatibility across different setups.
|
| 69 |
def generate(prompt, steps):
|
| 70 |
# Generate image with Stable Diffusion
|