Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,8 @@ import pickle
|
|
9 |
import sys
|
10 |
import subprocess
|
11 |
|
|
|
|
|
12 |
import gradio as gr
|
13 |
import numpy as np
|
14 |
import torch
|
@@ -67,9 +69,12 @@ def load_model(file_name: str, path:str,device: torch.device) -> nn.Module:
|
|
67 |
model(z, label, force_fp32=True)
|
68 |
return model
|
69 |
|
70 |
-
|
|
|
|
|
71 |
def greet(name):
|
72 |
return "Hello " + name + "!"
|
|
|
73 |
def main():
|
74 |
#torch.cuda.init()
|
75 |
#if torch.cuda.is_initialized():
|
@@ -94,14 +99,12 @@ def main():
|
|
94 |
img_out, _, _ = generator([latent])
|
95 |
imgs_arr = make_image(img_out)
|
96 |
#iface = gr.Interface(
|
97 |
-
#fn=
|
98 |
#inputs='text',
|
99 |
-
#outputs='text',
|
100 |
-
#examples=['result'],
|
101 |
#gr.outputs.Image(type='numpy', label='Output'),
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
#theme=args.theme,
|
106 |
#allow_flagging=args.allow_flagging,
|
107 |
#live=args.live,
|
@@ -112,8 +115,11 @@ def main():
|
|
112 |
#server_port=args.port,
|
113 |
#share=args.share,
|
114 |
#)
|
115 |
-
demo = gr.Interface(fn=
|
116 |
-
demo.launch()
|
|
|
|
|
|
|
117 |
if __name__ == '__main__':
|
118 |
main()
|
119 |
|
|
|
9 |
import sys
|
10 |
import subprocess
|
11 |
|
12 |
+
from matplotlib import pyplot as plt
|
13 |
+
|
14 |
import gradio as gr
|
15 |
import numpy as np
|
16 |
import torch
|
|
|
69 |
model(z, label, force_fp32=True)
|
70 |
return model
|
71 |
|
72 |
+
def image_create(input_img):
|
73 |
+
|
74 |
+
|
75 |
def greet(name):
|
76 |
return "Hello " + name + "!"
|
77 |
+
|
78 |
def main():
|
79 |
#torch.cuda.init()
|
80 |
#if torch.cuda.is_initialized():
|
|
|
99 |
img_out, _, _ = generator([latent])
|
100 |
imgs_arr = make_image(img_out)
|
101 |
#iface = gr.Interface(
|
102 |
+
#fn=image_create,
|
103 |
#inputs='text',
|
|
|
|
|
104 |
#gr.outputs.Image(type='numpy', label='Output'),
|
105 |
+
#title=TITLE,
|
106 |
+
#description=DESCRIPTION,
|
107 |
+
#article=ARTICLE,
|
108 |
#theme=args.theme,
|
109 |
#allow_flagging=args.allow_flagging,
|
110 |
#live=args.live,
|
|
|
115 |
#server_port=args.port,
|
116 |
#share=args.share,
|
117 |
#)
|
118 |
+
#demo = gr.Interface(fn=image_create, inputs="text", outputs="image")
|
119 |
+
#demo.launch()
|
120 |
+
plt.figure(figsize=(10, 10))
|
121 |
+
plt.imshow(imgs_arr[0])
|
122 |
+
plt.show()
|
123 |
if __name__ == '__main__':
|
124 |
main()
|
125 |
|