Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
-
from transformers import AutoProcessor,
|
| 6 |
|
| 7 |
# 1. Safely extract your secure secret token
|
| 8 |
hf_token = os.environ.get("HF_TOKEN")
|
|
@@ -10,11 +10,11 @@ hf_token = os.environ.get("HF_TOKEN")
|
|
| 10 |
# 2. Define target repository path
|
| 11 |
MODEL_ID = "guangyangmusic/legato-small"
|
| 12 |
|
| 13 |
-
print("Loading
|
| 14 |
|
| 15 |
-
#
|
| 16 |
processor = AutoProcessor.from_pretrained(MODEL_ID, token=hf_token, trust_remote_code=True)
|
| 17 |
-
model =
|
| 18 |
MODEL_ID,
|
| 19 |
token=hf_token,
|
| 20 |
trust_remote_code=True,
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
+
from transformers import AutoProcessor, AutoModelForImageTextToText
|
| 6 |
|
| 7 |
# 1. Safely extract your secure secret token
|
| 8 |
hf_token = os.environ.get("HF_TOKEN")
|
|
|
|
| 10 |
# 2. Define target repository path
|
| 11 |
MODEL_ID = "guangyangmusic/legato-small"
|
| 12 |
|
| 13 |
+
print("Loading model architecture and weights...")
|
| 14 |
|
| 15 |
+
# FIX: Use the updated AutoModelForImageTextToText class for modern transformers compatibility
|
| 16 |
processor = AutoProcessor.from_pretrained(MODEL_ID, token=hf_token, trust_remote_code=True)
|
| 17 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 18 |
MODEL_ID,
|
| 19 |
token=hf_token,
|
| 20 |
trust_remote_code=True,
|