Spaces:
Configuration error
Configuration error
upd
Browse files
app.py
CHANGED
|
@@ -22,6 +22,8 @@ counter = 0
|
|
| 22 |
|
| 23 |
#Getting Lora fine-tuned weights
|
| 24 |
def monkeypatching(alpha, in_prompt): #, prompt, pipe): finetuned_lora_weights
|
|
|
|
|
|
|
| 25 |
global counter
|
| 26 |
if counter == 0 :
|
| 27 |
monkeypatch_lora(pipe.unet, torch.load("./output_example/lora_weight.pt")) #finetuned_lora_weights
|
|
@@ -29,7 +31,7 @@ def monkeypatching(alpha, in_prompt): #, prompt, pipe): finetuned_lora_weights
|
|
| 29 |
counter +=1
|
| 30 |
else :
|
| 31 |
tune_lora_scale(pipe.unet, alpha) #1.00)
|
| 32 |
-
prompt = "style of sks, " + in_prompt
|
| 33 |
image = pipe(prompt, num_inference_steps=50, guidance_scale=7).images[0]
|
| 34 |
image.save("./illust_lora.jpg") #"./contents/illust_lora.jpg")
|
| 35 |
return image
|
|
@@ -63,7 +65,7 @@ with gr.Blocks() as demo:
|
|
| 63 |
b1 = gr.Button(value="Train LORA model")
|
| 64 |
b2 = gr.Button(value="Inference using LORA model")
|
| 65 |
with gr.Row():
|
| 66 |
-
in_prompt = gr.Textbox(label="Enter a prompt for fine-tuned LORA model")
|
| 67 |
out_image = gr.Image(label="Image generated by LORA model")
|
| 68 |
out_file = gr.File(label="Lora trained model weights")
|
| 69 |
b1.click(fn = accelerate_train_lora, inputs=in_steps, outputs=out_file)
|
|
|
|
| 22 |
|
| 23 |
#Getting Lora fine-tuned weights
|
| 24 |
def monkeypatching(alpha, in_prompt): #, prompt, pipe): finetuned_lora_weights
|
| 25 |
+
print("****** inside monkeypatching *******")
|
| 26 |
+
print(f"in_prompt is - {str(in_prompt)}")
|
| 27 |
global counter
|
| 28 |
if counter == 0 :
|
| 29 |
monkeypatch_lora(pipe.unet, torch.load("./output_example/lora_weight.pt")) #finetuned_lora_weights
|
|
|
|
| 31 |
counter +=1
|
| 32 |
else :
|
| 33 |
tune_lora_scale(pipe.unet, alpha) #1.00)
|
| 34 |
+
prompt = "style of sks, " + str(in_prompt) #"baby lion"
|
| 35 |
image = pipe(prompt, num_inference_steps=50, guidance_scale=7).images[0]
|
| 36 |
image.save("./illust_lora.jpg") #"./contents/illust_lora.jpg")
|
| 37 |
return image
|
|
|
|
| 65 |
b1 = gr.Button(value="Train LORA model")
|
| 66 |
b2 = gr.Button(value="Inference using LORA model")
|
| 67 |
with gr.Row():
|
| 68 |
+
in_prompt = gr.Textbox(label="Enter a prompt for fine-tuned LORA model", visible=True)
|
| 69 |
out_image = gr.Image(label="Image generated by LORA model")
|
| 70 |
out_file = gr.File(label="Lora trained model weights")
|
| 71 |
b1.click(fn = accelerate_train_lora, inputs=in_steps, outputs=out_file)
|