Spaces:
Runtime error
Runtime error
gokaygokay
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -121,13 +121,13 @@ DEFAULT_NEGATIVE_SUFFIX = "Nsfw oversaturated crappy_art low_quality blurry bad_
|
|
121 |
# Initialize Florence model
|
122 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
123 |
|
124 |
-
def load_models():
|
125 |
-
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
126 |
-
|
127 |
-
|
128 |
-
return florence_model, florence_processor
|
129 |
|
130 |
-
florence_model, florence_processor = load_models()
|
131 |
|
132 |
# Prompt Enhancer
|
133 |
enhancer_medium = pipeline("summarization", model="gokaygokay/Lamini-Prompt-Enchance", device=device)
|
|
|
121 |
# Initialize Florence model
|
122 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
123 |
|
124 |
+
#def load_models():
|
125 |
+
#with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
126 |
+
florence_model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True).to(device).eval()
|
127 |
+
florence_processor = AutoProcessor.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True)
|
128 |
+
#return florence_model, florence_processor
|
129 |
|
130 |
+
#florence_model, florence_processor = load_models()
|
131 |
|
132 |
# Prompt Enhancer
|
133 |
enhancer_medium = pipeline("summarization", model="gokaygokay/Lamini-Prompt-Enchance", device=device)
|