Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
|
3 |
import cv2
|
|
|
1 |
+
'''
|
2 |
+
https://huggingface.co/spaces/svjack/Image_Face_Upscale_Restoration-GFPGAN
|
3 |
+
|
4 |
+
pip install gradio spaces "httpx[socks]"
|
5 |
+
pip install -r requirements.txt
|
6 |
+
|
7 |
+
vim /environment/miniconda3/lib/python3.11/site-packages/basicsr/data/degradations.py
|
8 |
+
from torchvision.transforms.functional_tensor import rgb_to_grayscale
|
9 |
+
->
|
10 |
+
from torchvision.transforms._functional_tensor import rgb_to_grayscale
|
11 |
+
|
12 |
+
|
13 |
+
from gradio_client import Client, handle_file
|
14 |
+
|
15 |
+
client = Client("http://localhost:7860")
|
16 |
+
result = client.predict(
|
17 |
+
img=handle_file('https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png'),
|
18 |
+
version="v1.4",
|
19 |
+
scale=2,
|
20 |
+
api_name="/inference"
|
21 |
+
)
|
22 |
+
print(result)
|
23 |
+
|
24 |
+
from PIL import Image
|
25 |
+
Image.open(result[-1])
|
26 |
+
'''
|
27 |
+
|
28 |
import os
|
29 |
|
30 |
import cv2
|