Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,11 +10,18 @@ subprocess.run(
|
|
10 |
check=True
|
11 |
)
|
12 |
|
13 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
florence_processor = AutoProcessor.from_pretrained(model, trust_remote_code=True)
|
19 |
|
20 |
def generate_caption(image):
|
|
|
10 |
check=True
|
11 |
)
|
12 |
|
13 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "CPU")
|
14 |
+
|
15 |
+
config = AutoConfig.from_pretrained(model_id, trust_remote_code=True)
|
16 |
+
|
17 |
+
module_base = config.__module__.rsplit(".", 1)[0]
|
18 |
+
modeling_mod_path = module_base + ".modeling_florence2"
|
19 |
+
modeling_mod = importlib.import_module(modeling_mod_path)
|
20 |
+
|
21 |
+
FlorenceLM = getattr(
|
22 |
+
modeling_mod,
|
23 |
+
"Florence2LanguageForConditionalGeneration"
|
24 |
+
)
|
25 |
florence_processor = AutoProcessor.from_pretrained(model, trust_remote_code=True)
|
26 |
|
27 |
def generate_caption(image):
|