Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,44 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from diffusers.models import UNet2DModel
|
4 |
+
from huggingface_hub import hf_hub_url, cached_download
|
5 |
|
|
|
|
|
6 |
|
7 |
+
config_file_url = hf_hub_url(repo_id="porestar/oadg_channels_64", filename="model.pt", revision="main")
|
8 |
+
cached_download(config_file_url)
|
9 |
+
|
10 |
+
model = UNet2DModel(
|
11 |
+
sample_size=64,
|
12 |
+
in_channels=2,
|
13 |
+
out_channels=2,
|
14 |
+
layers_per_block=2,
|
15 |
+
block_out_channels=(64, 64, 128, 128),
|
16 |
+
down_block_types=(
|
17 |
+
"DownBlock2D",
|
18 |
+
"DownBlock2D",
|
19 |
+
"AttnDownBlock2D",
|
20 |
+
"DownBlock2D",
|
21 |
+
),
|
22 |
+
up_block_types=(
|
23 |
+
"UpBlock2D",
|
24 |
+
"AttnUpBlock2D",
|
25 |
+
"UpBlock2D",
|
26 |
+
"UpBlock2D",
|
27 |
+
),
|
28 |
+
)
|
29 |
+
|
30 |
+
model.load_state_dict(torch.load("./oadg_channels_64/model.pt"))
|
31 |
+
|
32 |
+
|
33 |
+
def classify_image(inp):
|
34 |
+
return {"lol": 0}
|
35 |
+
|
36 |
+
|
37 |
+
img = gr.Image(image_mode="L", source="canvas", shape=(32, 32), invert_colors=False)
|
38 |
+
label = gr.Label(num_top_classes=3)
|
39 |
+
|
40 |
+
demo = gr.Interface(
|
41 |
+
fn=classify_image, inputs=img, outputs=label, interpretation="default"
|
42 |
+
)
|
43 |
+
|
44 |
+
demo.launch()
|