Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import login, HfFileSystem, HfApi, ModelCard
|
3 |
import os
|
|
|
|
|
4 |
|
5 |
is_shared_ui = True if "fffiloni/sd-xl-custom-model" in os.environ['SPACE_ID'] else False
|
6 |
hf_token = os.environ.get("HF_TOKEN")
|
@@ -53,7 +55,7 @@ def load_model(custom_model):
|
|
53 |
return gr.update(choices=sfts_available_files, value=sfts_available_files[0], visible=True), gr.update(value=instance_prompt, visible=True)
|
54 |
|
55 |
|
56 |
-
|
57 |
def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
|
58 |
|
59 |
if weight_name == "NO SAFETENSORS FILE":
|
@@ -206,7 +208,8 @@ with gr.Blocks(css=css) as demo:
|
|
206 |
load_model_btn.click(
|
207 |
fn = load_model,
|
208 |
inputs=[custom_model],
|
209 |
-
outputs = [model_status, weight_name, trigger_word]
|
|
|
210 |
)
|
211 |
submit_btn.click(
|
212 |
fn = infer,
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import login, HfFileSystem, HfApi, ModelCard
|
3 |
import os
|
4 |
+
import random
|
5 |
+
import spaces
|
6 |
|
7 |
is_shared_ui = True if "fffiloni/sd-xl-custom-model" in os.environ['SPACE_ID'] else False
|
8 |
hf_token = os.environ.get("HF_TOKEN")
|
|
|
55 |
return gr.update(choices=sfts_available_files, value=sfts_available_files[0], visible=True), gr.update(value=instance_prompt, visible=True)
|
56 |
|
57 |
|
58 |
+
@spaces.GPU
|
59 |
def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
|
60 |
|
61 |
if weight_name == "NO SAFETENSORS FILE":
|
|
|
208 |
load_model_btn.click(
|
209 |
fn = load_model,
|
210 |
inputs=[custom_model],
|
211 |
+
outputs = [model_status, weight_name, trigger_word],
|
212 |
+
queue = False
|
213 |
)
|
214 |
submit_btn.click(
|
215 |
fn = infer,
|