Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import torch
|
|
4 |
import argparse
|
5 |
import numpy as np
|
6 |
import gradio as gr
|
|
|
7 |
|
8 |
from PIL import Image
|
9 |
from copy import deepcopy
|
@@ -90,6 +91,8 @@ model = model.to(device)
|
|
90 |
print ("IMAGE MODEL CKPT:", MODEL_NAME)
|
91 |
load_network(model, MODEL_NAME, strict=True, param_key='params')
|
92 |
|
|
|
|
|
93 |
|
94 |
css = """
|
95 |
/* .image-frame img, .image-container img {
|
@@ -102,13 +105,13 @@ css = """
|
|
102 |
|
103 |
demo = gr.Interface(
|
104 |
fn=process_img,
|
105 |
-
inputs=[gr.Image(type="pil", label="Изображение")
|
106 |
outputs=ImageSlider(label="Улучшенное качество",
|
107 |
type="pil",
|
108 |
show_download_button=True,
|
109 |
-
),
|
110 |
css=css,
|
111 |
)
|
112 |
|
113 |
if __name__ == "__main__":
|
114 |
-
demo.launch()
|
|
|
4 |
import argparse
|
5 |
import numpy as np
|
6 |
import gradio as gr
|
7 |
+
import tempfile
|
8 |
|
9 |
from PIL import Image
|
10 |
from copy import deepcopy
|
|
|
91 |
print ("IMAGE MODEL CKPT:", MODEL_NAME)
|
92 |
load_network(model, MODEL_NAME, strict=True, param_key='params')
|
93 |
|
94 |
+
# Create a temporary directory for Gradio
|
95 |
+
temp_dir = tempfile.TemporaryDirectory()
|
96 |
|
97 |
css = """
|
98 |
/* .image-frame img, .image-container img {
|
|
|
105 |
|
106 |
demo = gr.Interface(
|
107 |
fn=process_img,
|
108 |
+
inputs=[gr.Image(type="pil", label="Изображение", temp_dir=temp_dir.name)],
|
109 |
outputs=ImageSlider(label="Улучшенное качество",
|
110 |
type="pil",
|
111 |
show_download_button=True,
|
112 |
+
),
|
113 |
css=css,
|
114 |
)
|
115 |
|
116 |
if __name__ == "__main__":
|
117 |
+
demo.launch()
|