Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def scrape_lora_link(url):
|
|
55 |
return None
|
56 |
|
57 |
except requests.RequestException as e:
|
58 |
-
|
59 |
return None
|
60 |
|
61 |
def enable_lora(lora_scale,lora_add):
|
@@ -63,10 +63,13 @@ def enable_lora(lora_scale,lora_add):
|
|
63 |
gr.Info("No Lora Loaded, Use basemodel")
|
64 |
else:
|
65 |
url = f'https://huggingface.co/{lora_add}/tree/main'
|
66 |
-
lora_name = scrape_lora_link(url)
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
@spaces.GPU()
|
72 |
def generate_image(
|
@@ -118,7 +121,7 @@ examples = [
|
|
118 |
|
119 |
with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
|
120 |
gr.HTML("<h1><center>Flux Labs</center></h1>")
|
121 |
-
gr.HTML("<p><center>
|
122 |
with gr.Row():
|
123 |
with gr.Column(scale=4):
|
124 |
img = gr.Gallery(label='flux Generated Image', columns = 1, preview=True, height=600)
|
|
|
55 |
return None
|
56 |
|
57 |
except requests.RequestException as e:
|
58 |
+
raise gr.Error(f"An error occurred while fetching the URL: {e}")
|
59 |
return None
|
60 |
|
61 |
def enable_lora(lora_scale,lora_add):
|
|
|
63 |
gr.Info("No Lora Loaded, Use basemodel")
|
64 |
else:
|
65 |
url = f'https://huggingface.co/{lora_add}/tree/main'
|
66 |
+
lora_name = scrape_lora_link(url)
|
67 |
+
if lora_name:
|
68 |
+
pipe.load_lora_weights(lora_add, weight_name=lora_name)
|
69 |
+
pipe.fuse_lora(lora_scale=lora_scale)
|
70 |
+
gr.Info(f"{lora_add} Loaded")
|
71 |
+
else:
|
72 |
+
gr.Warning(f"{lora_add} Load fail, check again.")
|
73 |
|
74 |
@spaces.GPU()
|
75 |
def generate_image(
|
|
|
121 |
|
122 |
with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
|
123 |
gr.HTML("<h1><center>Flux Labs</center></h1>")
|
124 |
+
gr.HTML("<p><center>Load the LoRA model on the menu</center></p>")
|
125 |
with gr.Row():
|
126 |
with gr.Column(scale=4):
|
127 |
img = gr.Gallery(label='flux Generated Image', columns = 1, preview=True, height=600)
|