Spaces:
Sleeping
Sleeping
Commit
·
d9847a8
1
Parent(s):
022b7ae
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
-
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
def inference(img):
|
| 3 |
+
out = face2paint(model, img)
|
| 4 |
+
return out
|
| 5 |
+
iface = gr.Interface(fn=inference, inputs=gr.inputs.Image(type="pil"), outputs=gr.outputs.Image(type="pil"),examples=['/content/gongyoo.jpeg'])
|
| 6 |
+
iface.launch()
|
| 7 |
from PIL import Image
|
| 8 |
+
import torch
|
| 9 |
+
model = torch.hub.load(
|
| 10 |
+
"AK391/animegan2-pytorch:main",
|
| 11 |
+
"generator",
|
| 12 |
+
pretrained=True)
|
| 13 |
+
face2paint = torch.hub.load(
|
| 14 |
+
'AK391/animegan2-pytorch:main', 'face2paint',
|
| 15 |
+
size=512)
|
| 16 |
+
def inference(img):
|
| 17 |
+
out = face2paint(model, img)
|
| 18 |
+
return out
|
| 19 |
+
iface = gr.Interface(fn=inference, inputs=gr.inputs.Image(type="pil"), outputs=gr.outputs.Image(type="pil"),examples=['/content/gongyoo.jpeg'])
|
| 20 |
+
iface.launch()
|