Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from PIL import Image
|
|
| 3 |
import numpy as np
|
| 4 |
from transformers import AutoModel
|
| 5 |
import torch
|
|
|
|
| 6 |
|
| 7 |
# Load the model
|
| 8 |
model = AutoModel.from_pretrained("ragavsachdeva/magiv2", trust_remote_code=True).cuda().eval()
|
|
@@ -12,6 +13,7 @@ def read_image(image):
|
|
| 12 |
image = np.array(image)
|
| 13 |
return image
|
| 14 |
|
|
|
|
| 15 |
def process_images(chapter_pages, character_bank_images, character_bank_names):
|
| 16 |
chapter_pages = [read_image(image) for image in chapter_pages]
|
| 17 |
character_bank = {
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
from transformers import AutoModel
|
| 5 |
import torch
|
| 6 |
+
import spaces
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
model = AutoModel.from_pretrained("ragavsachdeva/magiv2", trust_remote_code=True).cuda().eval()
|
|
|
|
| 13 |
image = np.array(image)
|
| 14 |
return image
|
| 15 |
|
| 16 |
+
@spaces.GPU
|
| 17 |
def process_images(chapter_pages, character_bank_images, character_bank_names):
|
| 18 |
chapter_pages = [read_image(image) for image in chapter_pages]
|
| 19 |
character_bank = {
|