Adonai Vera commited on
Commit
305eb2c
·
1 Parent(s): 594fb4e

Model in private repo

Browse files
.DS_Store ADDED
Binary file (6.15 kB). View file
 
README 2.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Ofwat Material Classification Demo
3
+ emoji: 🔥
4
+ colorFrom: green
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 4.7.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
README 3.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Ofwat Defects Classification Demo
3
+ emoji: 😻
4
+ colorFrom: gray
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 4.7.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from turtle import title
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+ from PIL import Image
5
+
6
+ # Initialize the pipeline with your model
7
+ pipe = pipeline("image-classification", model="SubterraAI/ofwat_cleaner_classification")
8
+
9
+ def classify_image(image):
10
+ # Convert the input image to PIL format
11
+ PIL_image = Image.fromarray(image).convert('RGB')
12
+
13
+ # Classify the image using the pipeline
14
+ res = pipe(PIL_image)
15
+
16
+ # Extract labels and scores
17
+ return {dic["label"]: dic["score"] for dic in res}
18
+
19
+ # Create the Gradio interface
20
+ iface = gr.Interface(
21
+ classify_image,
22
+ "image",
23
+ "label",
24
+ examples=[
25
+ ["examples/CS.jpg"],
26
+ ["examples/GI.jpg"],
27
+ ["examples/PP.jpg"],
28
+ ["examples/RC.jpg"]
29
+ ],
30
+ description="Upload an image to classify its material.",
31
+ title="Cleaner Classification with AI by Subterra"
32
+ )
33
+
34
+ # Launch the interface
35
+ iface.launch()
examples/.DS_Store ADDED
Binary file (6.15 kB). View file
 
examples/CS.jpg ADDED
examples/GI.jpg ADDED
examples/PP.jpg ADDED
examples/RC.jpg ADDED
flagged/image/d97b9ae054eab1bd10dc/PP.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ image,output 0,output 1,flag,username,timestamp
2
+ "{""path"":""flagged/image/d97b9ae054eab1bd10dc/PP.jpg"",""url"":""http://127.0.0.1:7860/file=/private/var/folders/5q/yl8pmxm116g6r3k8fd9gk74m0000gn/T/gradio/12885a897d79141c54ccb542582449159242eaa0/PP.jpg"",""size"":null,""orig_name"":""PP.jpg"",""mime_type"":null}","{""label"":""VC"",""confidences"":[{""label"":""VC"",""confidence"":0.7706952691078186},{""label"":""PVC"",""confidence"":0.20648105442523956},{""label"":""PE"",""confidence"":0.005161861423403025},{""label"":""PF"",""confidence"":0.004196972120553255},{""label"":""CO"",""confidence"":0.0034184197429567575}]}","| Prefix | Full Name |
3
+ | ------ | --------- |
4
+ | CS | Carbon Steel |
5
+ | GI | Galvanized Iron |
6
+ | PP | Polypropylene |
7
+ | RC | Reinforced Concrete |",,,2023-11-27 15:26:38.548865
requirements.txt ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate==0.24.1
2
+ aiofiles==23.2.1
3
+ aiohttp==3.9.0
4
+ aiosignal==1.3.1
5
+ altair==5.1.2
6
+ annotated-types==0.6.0
7
+ anyio==3.7.1
8
+ async-timeout==4.0.3
9
+ attrs==23.1.0
10
+ certifi==2023.11.17
11
+ charset-normalizer==3.3.2
12
+ click==8.1.7
13
+ colorama==0.4.6
14
+ contourpy==1.2.0
15
+ cycler==0.12.1
16
+ datasets==2.4.0
17
+ dill==0.3.5.1
18
+ evaluate==0.4.1
19
+ exceptiongroup==1.2.0
20
+ ExifRead==3.0.0
21
+ fastapi==0.104.1
22
+ ffmpy==0.3.1
23
+ filelock==3.13.1
24
+ fonttools==4.45.1
25
+ frozenlist==1.4.0
26
+ fsspec==2023.10.0
27
+ gradio==4.7.1
28
+ gradio_client==0.7.0
29
+ h11==0.14.0
30
+ httpcore==1.0.2
31
+ httpx==0.25.2
32
+ huggingface-hub==0.19.4
33
+ idna==3.4
34
+ importlib-resources==6.1.1
35
+ Jinja2==3.1.2
36
+ joblib==1.3.2
37
+ jsonschema==4.20.0
38
+ jsonschema-specifications==2023.11.1
39
+ kiwisolver==1.4.5
40
+ markdown-it-py==3.0.0
41
+ MarkupSafe==2.1.3
42
+ matplotlib==3.8.2
43
+ mdurl==0.1.2
44
+ mpmath==1.3.0
45
+ multidict==6.0.4
46
+ multiprocess==0.70.13
47
+ networkx==3.2.1
48
+ numpy==1.26.2
49
+ orjson==3.9.10
50
+ packaging==23.2
51
+ pandas==2.1.3
52
+ Pillow==10.1.0
53
+ psutil==5.9.6
54
+ pyarrow==14.0.1
55
+ pyarrow-hotfix==0.6
56
+ pydantic==2.5.2
57
+ pydantic_core==2.14.5
58
+ pydub==0.25.1
59
+ Pygments==2.17.2
60
+ pyparsing==3.1.1
61
+ python-dateutil==2.8.2
62
+ python-multipart==0.0.6
63
+ pytz==2023.3.post1
64
+ PyYAML==6.0.1
65
+ referencing==0.31.0
66
+ regex==2023.10.3
67
+ requests==2.31.0
68
+ responses==0.18.0
69
+ rich==13.7.0
70
+ rpds-py==0.13.1
71
+ safetensors==0.4.0
72
+ scikit-learn==1.3.2
73
+ scipy==1.11.4
74
+ semantic-version==2.10.0
75
+ shellingham==1.5.4
76
+ six==1.16.0
77
+ sniffio==1.3.0
78
+ starlette==0.27.0
79
+ sympy==1.12
80
+ threadpoolctl==3.2.0
81
+ tokenizers==0.15.0
82
+ tomlkit==0.12.0
83
+ toolz==0.12.0
84
+ torch==2.1.1
85
+ torchvision==0.16.1
86
+ tqdm==4.66.1
87
+ transformers @ git+https://github.com/huggingface/transformers@c5be38cd27bee92be73c73ba09aec8bedf841423
88
+ typer==0.9.0
89
+ typing_extensions==4.8.0
90
+ tzdata==2023.3
91
+ urllib3==2.1.0
92
+ uvicorn==0.24.0.post1
93
+ websockets==11.0.3
94
+ xxhash==3.4.1
95
+ yarl==1.9.3
96
+ zipp==3.17.0