Spaces:
Runtime error
Runtime error
lihao57 commited on
Commit ·
08092af
1
Parent(s): 840a94e
remove opencv dependencies
Browse files- app.py +2 -6
- requirements.txt +0 -1
app.py
CHANGED
|
@@ -8,9 +8,7 @@
|
|
| 8 |
@Contact : 2909171338@qq.com
|
| 9 |
"""
|
| 10 |
|
| 11 |
-
import os
|
| 12 |
import gradio as gr
|
| 13 |
-
import cv2
|
| 14 |
from PIL import Image
|
| 15 |
import io
|
| 16 |
import matplotlib.pyplot as plt
|
|
@@ -32,7 +30,6 @@ def get_dataset():
|
|
| 32 |
"""
|
| 33 |
global ds
|
| 34 |
if ds is None:
|
| 35 |
-
# ds = load_dataset("parquet", data_files={"train": "train/metadata.parquet", "test": "test/metadata.parquet"})
|
| 36 |
ds = load_dataset("lh9171338/Wireframe")
|
| 37 |
return ds
|
| 38 |
|
|
@@ -74,7 +71,7 @@ def draw_lines(image, lines):
|
|
| 74 |
fig.add_axes(ax)
|
| 75 |
plt.xlim([-0.5, width - 0.5])
|
| 76 |
plt.ylim([height - 0.5, -0.5])
|
| 77 |
-
plt.imshow(image
|
| 78 |
for pts in lines:
|
| 79 |
pts = pts - 0.5
|
| 80 |
plt.plot(pts[:, 0], pts[:, 1], color="orange", linewidth=0.5)
|
|
@@ -101,8 +98,7 @@ def show_image(split, index):
|
|
| 101 |
"""
|
| 102 |
ds = get_dataset()
|
| 103 |
example = ds[split][index]
|
| 104 |
-
|
| 105 |
-
image = cv2.imread(image_file)
|
| 106 |
lines = np.array(example["lines"])
|
| 107 |
image = draw_lines(image, lines)
|
| 108 |
return image
|
|
|
|
| 8 |
@Contact : 2909171338@qq.com
|
| 9 |
"""
|
| 10 |
|
|
|
|
| 11 |
import gradio as gr
|
|
|
|
| 12 |
from PIL import Image
|
| 13 |
import io
|
| 14 |
import matplotlib.pyplot as plt
|
|
|
|
| 30 |
"""
|
| 31 |
global ds
|
| 32 |
if ds is None:
|
|
|
|
| 33 |
ds = load_dataset("lh9171338/Wireframe")
|
| 34 |
return ds
|
| 35 |
|
|
|
|
| 71 |
fig.add_axes(ax)
|
| 72 |
plt.xlim([-0.5, width - 0.5])
|
| 73 |
plt.ylim([height - 0.5, -0.5])
|
| 74 |
+
plt.imshow(image)
|
| 75 |
for pts in lines:
|
| 76 |
pts = pts - 0.5
|
| 77 |
plt.plot(pts[:, 0], pts[:, 1], color="orange", linewidth=0.5)
|
|
|
|
| 98 |
"""
|
| 99 |
ds = get_dataset()
|
| 100 |
example = ds[split][index]
|
| 101 |
+
image = np.array(example["image"])
|
|
|
|
| 102 |
lines = np.array(example["lines"])
|
| 103 |
image = draw_lines(image, lines)
|
| 104 |
return image
|
requirements.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
datasets
|
| 2 |
matplotlib
|
| 3 |
numpy
|
| 4 |
-
opencv-python
|
| 5 |
pillow
|
|
|
|
| 1 |
datasets
|
| 2 |
matplotlib
|
| 3 |
numpy
|
|
|
|
| 4 |
pillow
|