-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmix.exs
More file actions
158 lines (141 loc) · 3.89 KB
/
Copy pathmix.exs
File metadata and controls
158 lines (141 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
defmodule ImageVision.MixProject do
use Mix.Project
@version "0.4.0"
@app_name "image_vision"
def project do
[
app: String.to_atom(@app_name),
version: @version,
elixir: "~> 1.17",
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
source_url: "https://github.com/elixir-image/image_vision",
docs: docs(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
description: description(),
package: package(),
aliases: aliases(),
dialyzer: [
ignore_warnings: ".dialyzer_ignore_warnings",
plt_add_apps: ~w(mix nx ortex bumblebee)a
],
compilers: Mix.compilers()
]
end
defp description do
"""
Simple image classification, embedding, object detection,
segmentation, background removal, captioning, and zero-shot
classification for the `image` library. Powered by Bumblebee and
Ortex with strong, permissively-licensed defaults — no ML
expertise required.
"""
end
def application do
[
mod: {ImageVision.Application, []},
extra_applications: [:logger, :inets, :crypto]
]
end
defp deps do
[
# The core image-processing library.
{:image, "~> 0.66"},
# Used to download ONNX model weights on first call.
{:req, "~> 0.5"},
# Transitive workaround: the `:color` dep (pulled in via `:image`)
# has a `Code.ensure_loaded?(Plug.Router)` check that misbehaves on
# Elixir 1.20-rc.4. Including `:plug` ensures the conditional
# branch compiles cleanly. Remove once `:color` upstream is fixed.
{:plug, "~> 1.15", optional: true},
# --- ML deps ---
#
# Segmentation and detection run ONNX models via Ortex.
{:ortex, "~> 0.1", optional: true},
#
# Classification and embedding use Bumblebee servings.
{:bumblebee, "~> 0.7", optional: true},
#
# Nx and EXLA are required for inference.
{:nx, "~> 0.12"},
{:exla, "~> 0.12"},
# --- Tooling ---
{:ex_doc, "~> 0.18", only: [:release, :dev, :docs]},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
] ++ maybe_json_polyfill()
end
defp maybe_json_polyfill do
if Code.ensure_loaded?(:json) do
[]
else
[{:json_polyfill, "~> 0.2 or ~> 1.0"}]
end
end
defp package do
[
maintainers: ["Kip Cole"],
licenses: ["Apache-2.0"],
links: links(),
files: [
"lib",
"guides",
"logo.jpg",
"mix.exs",
"README*",
"CHANGELOG*",
"LICENSE*"
]
]
end
def links do
%{
"GitHub" => "https://github.com/elixir-image/image_vision",
"Readme" => "https://github.com/elixir-image/image_vision/blob/v#{@version}/README.md",
"Changelog" =>
"https://github.com/elixir-image/image_vision/blob/v#{@version}/CHANGELOG.md",
"image" => "https://hex.pm/packages/image",
"libvips" => "https://www.libvips.org"
}
end
def docs do
[
source_ref: "v#{@version}",
main: "readme",
logo: "logo.jpg",
extra_section: "Guides",
extras: extras(),
groups_for_extras: groups_for_extras(),
formatters: ["html", "markdown"],
skip_undefined_reference_warnings_on: ["changelog", "CHANGELOG.md"]
]
end
defp groups_for_extras do
[
Guides: ~r"guides/.*"
]
end
defp extras do
Enum.filter(
[
"README.md",
"LICENSE.md",
"CHANGELOG.md",
"guides/overview.md",
"guides/classification.md",
"guides/segmentation.md",
"guides/detection.md",
"guides/face_detection.md",
"guides/background.md",
"guides/captioning.md",
"guides/zero_shot.md"
],
&File.exists?/1
)
end
def aliases do
[]
end
defp elixirc_paths(:test), do: ["lib", "test"]
defp elixirc_paths(_), do: ["lib"]
end