Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -53,12 +53,18 @@ def scrape_lora_link(url):
|
|
53 |
|
54 |
# Use regular expression to find the link
|
55 |
pattern = r'href="(.*?lora.*?\.safetensors\?download=true)"'
|
|
|
56 |
match = re.search(pattern, content)
|
|
|
57 |
|
58 |
if match:
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
else:
|
63 |
return None
|
64 |
except requests.RequestException as e:
|
@@ -80,6 +86,7 @@ def enable_lora(lora_add,progress=gr.Progress(track_tqdm=True)):
|
|
80 |
else:
|
81 |
try:
|
82 |
pipe.load_lora_weights(lora_add)
|
|
|
83 |
gr.Info(f"{lora_add} Loaded")
|
84 |
return gr.update(label="LoRA Loaded Now")
|
85 |
except:
|
|
|
53 |
|
54 |
# Use regular expression to find the link
|
55 |
pattern = r'href="(.*?lora.*?\.safetensors\?download=true)"'
|
56 |
+
pattern2 = r'href="(.*?\.safetensors\?download=true)"'
|
57 |
match = re.search(pattern, content)
|
58 |
+
match2 = re.search(pattern2, content)
|
59 |
|
60 |
if match:
|
61 |
+
safetensors_url = match.group(1)
|
62 |
+
filename = safetensors_url.split('/')[-1].split('?')[0] # Extract the filename from the URL
|
63 |
+
return filename
|
64 |
+
elif match2:
|
65 |
+
safetensors_url = match2.group(1)
|
66 |
+
filename = safetensors_url.split('/')[-1].split('?')[0]
|
67 |
+
return filename
|
68 |
else:
|
69 |
return None
|
70 |
except requests.RequestException as e:
|
|
|
86 |
else:
|
87 |
try:
|
88 |
pipe.load_lora_weights(lora_add)
|
89 |
+
print(f'lora loading: {lora_add}')
|
90 |
gr.Info(f"{lora_add} Loaded")
|
91 |
return gr.update(label="LoRA Loaded Now")
|
92 |
except:
|