Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,11 +24,8 @@ def print_bn():
|
|
24 |
|
25 |
def update_bn(image):
|
26 |
cursor_im = 0
|
27 |
-
print("Before Resize:", image.shape)
|
28 |
-
|
29 |
image = T.Resize((40,40))(image)
|
30 |
image = image.reshape(-1)
|
31 |
-
print("After Resize:", image.shape)
|
32 |
for m in model.modules():
|
33 |
if(type(m) is nn.BatchNorm2d):
|
34 |
if(cursor_im < image.shape[0]):
|
@@ -44,10 +41,6 @@ def update_bn(image):
|
|
44 |
|
45 |
|
46 |
def greet(image):
|
47 |
-
# url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
48 |
-
# html = request_url(url)
|
49 |
-
# key = os.getenv("OPENAI_API_KEY")
|
50 |
-
# x = torch.ones([1,3,224,224])
|
51 |
if(image is None):
|
52 |
bn_data = print_bn()
|
53 |
return ','.join([f'{x:.2f}' for x in bn_data])
|
@@ -61,11 +54,11 @@ def greet(image):
|
|
61 |
update_bn(image)
|
62 |
print(image.shape)
|
63 |
out = model(image)
|
64 |
-
# model.train()
|
65 |
return "Hello world!"
|
66 |
|
67 |
|
68 |
|
69 |
-
image = gr.inputs.Image(label="Upload a photo for
|
70 |
-
|
|
|
71 |
iface.launch()
|
|
|
24 |
|
25 |
def update_bn(image):
|
26 |
cursor_im = 0
|
|
|
|
|
27 |
image = T.Resize((40,40))(image)
|
28 |
image = image.reshape(-1)
|
|
|
29 |
for m in model.modules():
|
30 |
if(type(m) is nn.BatchNorm2d):
|
31 |
if(cursor_im < image.shape[0]):
|
|
|
41 |
|
42 |
|
43 |
def greet(image):
|
|
|
|
|
|
|
|
|
44 |
if(image is None):
|
45 |
bn_data = print_bn()
|
46 |
return ','.join([f'{x:.2f}' for x in bn_data])
|
|
|
54 |
update_bn(image)
|
55 |
print(image.shape)
|
56 |
out = model(image)
|
|
|
57 |
return "Hello world!"
|
58 |
|
59 |
|
60 |
|
61 |
+
image = gr.inputs.Image(label="Upload a photo for beauty", shape=(224,224))
|
62 |
+
out_image = gr.inputs.Image(label='Yes, it becomes better.')
|
63 |
+
iface = gr.Interface(fn=greet, inputs=image, outputs='text')
|
64 |
iface.launch()
|