Update app.py
Browse files
app.py
CHANGED
|
@@ -392,22 +392,21 @@ def run_inversion(self, dict, pcs, epochs, weight_decay,lr):
|
|
| 392 |
def file_upload(file):
|
| 393 |
device="cuda"
|
| 394 |
weights = torch.load(file.name).to(device)
|
| 395 |
-
net = "model_"+str(uuid.uuid4())[:4]+".pt"
|
| 396 |
-
torch.save(weights, net)
|
| 397 |
|
| 398 |
#pad to 10000 Principal components to keep everything consistent
|
| 399 |
pcs = net.shape[1]
|
| 400 |
padding = torch.zeros((1,10000-pcs)).to(device)
|
| 401 |
weights = torch.cat((weights, padding), 1)
|
|
|
|
|
|
|
| 402 |
|
| 403 |
-
|
| 404 |
image = prompt = "sks person"
|
| 405 |
negative_prompt = "low quality, blurry, unfinished, nudity, weapon"
|
| 406 |
seed = 5
|
| 407 |
cfg = 3.0
|
| 408 |
steps = 25
|
| 409 |
image = inference(net, prompt, negative_prompt, cfg, steps, seed)
|
| 410 |
-
return net,
|
| 411 |
|
| 412 |
|
| 413 |
|
|
|
|
| 392 |
def file_upload(file):
|
| 393 |
device="cuda"
|
| 394 |
weights = torch.load(file.name).to(device)
|
|
|
|
|
|
|
| 395 |
|
| 396 |
#pad to 10000 Principal components to keep everything consistent
|
| 397 |
pcs = net.shape[1]
|
| 398 |
padding = torch.zeros((1,10000-pcs)).to(device)
|
| 399 |
weights = torch.cat((weights, padding), 1)
|
| 400 |
+
net = "model_"+str(uuid.uuid4())[:4]+".pt"
|
| 401 |
+
torch.save(weights, net)
|
| 402 |
|
|
|
|
| 403 |
image = prompt = "sks person"
|
| 404 |
negative_prompt = "low quality, blurry, unfinished, nudity, weapon"
|
| 405 |
seed = 5
|
| 406 |
cfg = 3.0
|
| 407 |
steps = 25
|
| 408 |
image = inference(net, prompt, negative_prompt, cfg, steps, seed)
|
| 409 |
+
return net,image
|
| 410 |
|
| 411 |
|
| 412 |
|