Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import numpy as np
|
|
4 |
import torch
|
5 |
import torch.nn as nn
|
6 |
import torchvision.transforms as transforms
|
7 |
-
from badnet_m import BadNet
|
8 |
|
9 |
import timm
|
10 |
|
@@ -37,16 +37,17 @@ def greet(text):
|
|
37 |
if(text == ''):
|
38 |
# return 'changing'
|
39 |
pipeline.unet.load_attn_procs('./pytorch_lora_weights.bin')
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
else:
|
44 |
# return 'pipelining'
|
45 |
images = pipeline(text).images
|
46 |
image = images[0]
|
47 |
return image
|
48 |
|
49 |
-
def
|
50 |
# url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
51 |
# html = request_url(url)
|
52 |
# key = os.getenv("OPENAI_API_KEY")
|
|
|
4 |
import torch
|
5 |
import torch.nn as nn
|
6 |
import torchvision.transforms as transforms
|
7 |
+
# from badnet_m import BadNet
|
8 |
|
9 |
import timm
|
10 |
|
|
|
37 |
if(text == ''):
|
38 |
# return 'changing'
|
39 |
pipeline.unet.load_attn_procs('./pytorch_lora_weights.bin')
|
40 |
+
pipeline.safety_checker = lambda images, clip_input: (images, False)
|
41 |
+
# images = pipeline('a photo of dog').images
|
42 |
+
# image = images[0]
|
43 |
+
return None
|
44 |
else:
|
45 |
# return 'pipelining'
|
46 |
images = pipeline(text).images
|
47 |
image = images[0]
|
48 |
return image
|
49 |
|
50 |
+
def greet_backdoor(image):
|
51 |
# url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
52 |
# html = request_url(url)
|
53 |
# key = os.getenv("OPENAI_API_KEY")
|