Spaces:
Runtime error
Runtime error
Commit ·
ee87be4
1
Parent(s): 90c5a91
Upload app.py
Browse files
app.py
CHANGED
|
@@ -8,8 +8,6 @@ import torch
|
|
| 8 |
model = test_1.load_trained_model()
|
| 9 |
|
| 10 |
|
| 11 |
-
# 判断是否在 Hugging Face 环境中
|
| 12 |
-
is_huggingface = 'HF_HOME' in os.environ
|
| 13 |
|
| 14 |
def convert_to_28x28_grid(canvas_image):
|
| 15 |
#将750x750画布转换为28x28数值矩阵
|
|
@@ -69,23 +67,13 @@ with gr.Blocks() as demo:
|
|
| 69 |
gr.Markdown("""# digit-recognition""")
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
type="pil"
|
| 80 |
-
)
|
| 81 |
-
else:
|
| 82 |
-
# 本地使用 shape 参数
|
| 83 |
-
input_image = gr.Sketchpad(
|
| 84 |
-
shape=(750, 750),
|
| 85 |
-
brush_color="black",
|
| 86 |
-
image_mode="L", # 确保输出是单通道
|
| 87 |
-
type="pil"
|
| 88 |
-
)
|
| 89 |
|
| 90 |
|
| 91 |
with gr.Row():
|
|
|
|
| 8 |
model = test_1.load_trained_model()
|
| 9 |
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def convert_to_28x28_grid(canvas_image):
|
| 13 |
#将750x750画布转换为28x28数值矩阵
|
|
|
|
| 67 |
gr.Markdown("""# digit-recognition""")
|
| 68 |
|
| 69 |
with gr.Row():
|
| 70 |
+
# 本地使用 shape 参数
|
| 71 |
+
input_image = gr.Sketchpad(
|
| 72 |
+
shape=(750, 750),
|
| 73 |
+
brush_color="black",
|
| 74 |
+
image_mode="L", # 确保输出是单通道
|
| 75 |
+
type="pil"
|
| 76 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
with gr.Row():
|