Spaces:
Running
Running
Synced repo using 'sync_with_huggingface' Github Action
Browse files- gradio_app.py +15 -1
- requirements-gpu.txt +5 -2
- requirements.txt +5 -2
gradio_app.py
CHANGED
@@ -16,6 +16,19 @@ def predict_fault(image, model):
|
|
16 |
return preds.item()
|
17 |
|
18 |
def detect(image, writing_type, post_it, corner, empty):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
writing_type_model, post_it_model, corner_model, empty_model = models
|
20 |
|
21 |
res_dict = {}
|
@@ -89,6 +102,7 @@ writing_type_transforms = transforms.Compose([
|
|
89 |
with gr.Blocks(title="Image Faulty Demo") as demo:
|
90 |
gr.Markdown("""
|
91 |
# Image Faulty
|
|
|
92 |
Find the project [here](https://github.com/xiaoyao9184/image-faulty).
|
93 |
""")
|
94 |
|
@@ -110,4 +124,4 @@ with gr.Blocks(title="Image Faulty Demo") as demo:
|
|
110 |
)
|
111 |
|
112 |
if __name__ == '__main__':
|
113 |
-
demo.launch()
|
|
|
16 |
return preds.item()
|
17 |
|
18 |
def detect(image, writing_type, post_it, corner, empty):
|
19 |
+
"""
|
20 |
+
Detect features in the image: writing type, post-it notes, corners, and empty.
|
21 |
+
|
22 |
+
Args:
|
23 |
+
image (Union[PIL.Image.Image, str]): The input image, either as a PIL image object or a URL string.
|
24 |
+
writing_type (bool): Whether to detect handwriting type.
|
25 |
+
post_it (bool): Whether to detect post-it notes.
|
26 |
+
corner (bool): Whether to detect corners in the image.
|
27 |
+
empty (bool): Whether to check if the image is empty.
|
28 |
+
|
29 |
+
Returns:
|
30 |
+
dict: A dictionary containing detection results for each enabled option.
|
31 |
+
"""
|
32 |
writing_type_model, post_it_model, corner_model, empty_model = models
|
33 |
|
34 |
res_dict = {}
|
|
|
102 |
with gr.Blocks(title="Image Faulty Demo") as demo:
|
103 |
gr.Markdown("""
|
104 |
# Image Faulty
|
105 |
+

|
106 |
Find the project [here](https://github.com/xiaoyao9184/image-faulty).
|
107 |
""")
|
108 |
|
|
|
124 |
)
|
125 |
|
126 |
if __name__ == '__main__':
|
127 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, mcp_server=True)
|
requirements-gpu.txt
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
-
gradio==5.
|
2 |
onnxruntime-gpu==1.20.1
|
3 |
torchvision==0.13.0
|
4 |
-
numpy==1.
|
|
|
|
|
|
|
|
1 |
+
gradio[mcp]==5.28.0
|
2 |
onnxruntime-gpu==1.20.1
|
3 |
torchvision==0.13.0
|
4 |
+
numpy==1.26.4
|
5 |
+
|
6 |
+
# gradio[mcp] 5.28.0 depends on pydantic>=2.11
|
7 |
+
pydantic==2.11.4
|
requirements.txt
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
-
gradio==5.
|
2 |
onnxruntime==1.20.1
|
3 |
torchvision==0.13.0
|
4 |
-
numpy==1.
|
|
|
|
|
|
|
|
1 |
+
gradio[mcp]==5.28.0
|
2 |
onnxruntime==1.20.1
|
3 |
torchvision==0.13.0
|
4 |
+
numpy==1.26.4
|
5 |
+
|
6 |
+
# gradio[mcp] 5.28.0 depends on pydantic>=2.11
|
7 |
+
pydantic==2.11.4
|