Spaces:
Running
Running
Update
Browse files
models.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
"""Model-related code and constants."""
|
| 2 |
|
|
|
|
| 3 |
import dataclasses
|
| 4 |
import os
|
| 5 |
import re
|
|
@@ -74,6 +75,7 @@ def pil_image_to_base64(image: PIL.Image.Image) -> str:
|
|
| 74 |
image.save(buffered, format='JPEG')
|
| 75 |
return base64.b64encode(buffered.getvalue()).decode('utf-8')
|
| 76 |
|
|
|
|
| 77 |
def generate(
|
| 78 |
model_name: str, sampler: str, image: PIL.Image.Image, prompt: str
|
| 79 |
) -> str:
|
|
|
|
| 1 |
"""Model-related code and constants."""
|
| 2 |
|
| 3 |
+
import spaces
|
| 4 |
import dataclasses
|
| 5 |
import os
|
| 6 |
import re
|
|
|
|
| 75 |
image.save(buffered, format='JPEG')
|
| 76 |
return base64.b64encode(buffered.getvalue()).decode('utf-8')
|
| 77 |
|
| 78 |
+
@spaces.GPU
|
| 79 |
def generate(
|
| 80 |
model_name: str, sampler: str, image: PIL.Image.Image, prompt: str
|
| 81 |
) -> str:
|