fxn 0.0.31__py3-none-any.whl → 0.0.33__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fxn/graph/client.py CHANGED
@@ -32,14 +32,12 @@ class GraphClient:
32
32
  json={ "query": query, "variables": variables },
33
33
  headers={ "Authorization": f"Bearer {self.access_key}" } if self.access_key else { }
34
34
  )
35
- # Check
36
35
  payload = response.json()
36
+ # Check error
37
37
  try:
38
38
  response.raise_for_status()
39
- except:
40
- raise RuntimeError(payload.get("error"))
41
- # Check error
42
- if "errors" in payload:
43
- raise RuntimeError(payload["errors"][0]["message"])
39
+ except Exception as ex:
40
+ error = payload["errors"][0]["message"] if "errors" in payload else str(ex)
41
+ raise RuntimeError(error)
44
42
  # Return
45
43
  return payload["data"]
Binary file
Binary file
@@ -44,7 +44,9 @@ class PredictionService:
44
44
  inputs: Dict[str, Union[ndarray, str, float, int, bool, List, Dict[str, Any], Path, Image.Image, Value]] = None,
45
45
  raw_outputs: bool=False,
46
46
  return_binary_path: bool=True,
47
- data_url_limit: int=None
47
+ data_url_limit: int=None,
48
+ client_id: str=None,
49
+ configuration_id: str=None
48
50
  ) -> Prediction:
49
51
  """
50
52
  Create a prediction.
@@ -55,6 +57,8 @@ class PredictionService:
55
57
  raw_outputs (bool): Skip converting output values into Pythonic types. This only applies to `CLOUD` predictions.
56
58
  return_binary_path (bool): Write binary values to file and return a `Path` instead of returning `BytesIO` instance.
57
59
  data_url_limit (int): Return a data URL if a given output value is smaller than this size in bytes. This only applies to `CLOUD` predictions.
60
+ client_id (str): Function client identifier. Specify this to override the current client identifier.
61
+ configuration_id (str): Configuration identifier. Specify this to override the current client configuration identifier.
58
62
 
59
63
  Returns:
60
64
  Prediction: Created prediction.
@@ -66,13 +70,13 @@ class PredictionService:
66
70
  key = uuid4().hex
67
71
  values = { name: self.to_value(value, name, key=key).model_dump(mode="json") for name, value in inputs.items() } if inputs is not None else { }
68
72
  # Query
69
- response = post( # INCOMPLETE # Configuration token
73
+ response = post(
70
74
  f"{self.client.api_url}/predict/{tag}?rawOutputs=true&dataUrlLimit={data_url_limit}",
71
75
  json=values,
72
76
  headers={
73
77
  "Authorization": f"Bearer {self.client.access_key}",
74
- "fxn-client": self.__get_client_id(),
75
- "fxn-configuration-token": self.__get_configuration_token()
78
+ "fxn-client": client_id if client_id is not None else self.__get_client_id(),
79
+ "fxn-configuration-token": configuration_id if configuration_id is not None else self.__get_configuration_id()
76
80
  }
77
81
  )
78
82
  # Check
@@ -84,12 +88,14 @@ class PredictionService:
84
88
  raise RuntimeError(error)
85
89
  # Parse prediction
86
90
  prediction = self.__parse_prediction(prediction, raw_outputs=raw_outputs, return_binary_path=return_binary_path)
91
+ # Check edge prediction
92
+ if prediction.type != PredictorType.Edge or raw_outputs:
93
+ return prediction
94
+ # Load edge predictor
95
+ predictor = self.__load(prediction)
96
+ self.__cache[tag] = predictor
87
97
  # Create edge prediction
88
- if prediction.type == PredictorType.Edge:
89
- predictor = self.__load(prediction)
90
- self.__cache[tag] = predictor
91
- prediction = self.__predict(tag=tag, predictor=predictor, inputs=inputs) if inputs is not None else prediction
92
- # Return
98
+ prediction = self.__predict(tag=tag, predictor=predictor, inputs=inputs) if inputs is not None else prediction
93
99
  return prediction
94
100
 
95
101
  async def stream (
@@ -100,6 +106,8 @@ class PredictionService:
100
106
  raw_outputs: bool=False,
101
107
  return_binary_path: bool=True,
102
108
  data_url_limit: int=None,
109
+ client_id: str=None,
110
+ configuration_id: str=None
103
111
  ) -> AsyncIterator[Prediction]:
104
112
  """
105
113
  Create a streaming prediction.
@@ -112,6 +120,8 @@ class PredictionService:
112
120
  raw_outputs (bool): Skip converting output values into Pythonic types. This only applies to `CLOUD` predictions.
113
121
  return_binary_path (bool): Write binary values to file and return a `Path` instead of returning `BytesIO` instance.
114
122
  data_url_limit (int): Return a data URL if a given output value is smaller than this size in bytes. This only applies to `CLOUD` predictions.
123
+ client_id (str): Function client identifier. Specify this to override the current client identifier.
124
+ configuration_id (str): Configuration identifier. Specify this to override the current client configuration identifier.
115
125
 
116
126
  Returns:
117
127
  Prediction: Created prediction.
@@ -122,14 +132,14 @@ class PredictionService:
122
132
  return
123
133
  # Serialize inputs
124
134
  key = uuid4().hex
125
- values = { name: self.to_value(value, name, key=key).model_dump(mode="json") for name, value in inputs.items() } # INCOMPLETE # values
135
+ values = { name: self.to_value(value, name, key=key).model_dump(mode="json") for name, value in inputs.items() }
126
136
  # Request
127
137
  url = f"{self.client.api_url}/predict/{tag}?stream=true&rawOutputs=true&dataUrlLimit={data_url_limit}"
128
138
  headers = {
129
139
  "Content-Type": "application/json",
130
140
  "Authorization": f"Bearer {self.client.access_key}",
131
- "fxn-client": self.__get_client_id(),
132
- "fxn-configuration-token": self.__get_configuration_token()
141
+ "fxn-client": client_id if client_id is not None else self.__get_client_id(),
142
+ "fxn-configuration-token": configuration_id if configuration_id is not None else self.__get_configuration_id()
133
143
  }
134
144
  async with ClientSession(headers=headers) as session:
135
145
  async with session.post(url, data=dumps(values)) as response:
@@ -143,12 +153,14 @@ class PredictionService:
143
153
  raise RuntimeError(error)
144
154
  # Parse prediction
145
155
  prediction = self.__parse_prediction(prediction, raw_outputs=raw_outputs, return_binary_path=return_binary_path)
146
- # Create edge prediction
147
- if prediction.type == PredictorType.Edge:
148
- predictor = self.__load(prediction)
149
- self.__cache[tag] = predictor
150
- prediction = self.__predict(tag=tag, predictor=predictor, inputs=inputs) if inputs is not None else prediction
151
- # Yield
156
+ # Check edge prediction
157
+ if prediction.type != PredictorType.Edge or raw_outputs:
158
+ return prediction
159
+ # Load edge predictor
160
+ predictor = self.__load(prediction)
161
+ self.__cache[tag] = predictor
162
+ # Create prediction
163
+ prediction = self.__predict(tag=tag, predictor=predictor, inputs=inputs) if inputs is not None else prediction
152
164
  yield prediction
153
165
 
154
166
  def to_object (
@@ -303,14 +315,14 @@ class PredictionService:
303
315
  return f"windows:{machine()}"
304
316
  raise RuntimeError(f"Function cannot make predictions on the {id} platform")
305
317
 
306
- def __get_configuration_token (self) -> Optional[str]:
318
+ def __get_configuration_id (self) -> Optional[str]:
307
319
  # Check
308
320
  if not self.__fxnc:
309
321
  return None
310
322
  # Get
311
323
  buffer = create_string_buffer(2048)
312
324
  status = self.__fxnc.FXNConfigurationGetUniqueID(buffer, len(buffer))
313
- assert status.value == FXNStatus.OK, f"Failed to create prediction configuration token with status: {status.value}"
325
+ assert status.value == FXNStatus.OK, f"Failed to create prediction configuration identifier with status: {status.value}"
314
326
  uid = buffer.value.decode("utf-8")
315
327
  # Return
316
328
  return uid
fxn/services/predictor.py CHANGED
@@ -28,7 +28,7 @@ class PredictorService:
28
28
  Predictor: Predictor.
29
29
  """
30
30
  # Query
31
- response = self.client.queryfxn(f"""
31
+ response = self.client.query(f"""
32
32
  query ($input: PredictorInput!) {{
33
33
  predictor (input: $input) {{
34
34
  {PREDICTOR_FIELDS}
fxn/version.py CHANGED
@@ -3,4 +3,4 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- __version__ = "0.0.31"
6
+ __version__ = "0.0.33"
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.1
2
+ Name: fxn
3
+ Version: 0.0.33
4
+ Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
+ Author-email: "NatML Inc." <hi@fxn.ai>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright [yyyy] [name of copyright owner]
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+ Project-URL: Homepage, https://fxn.ai
208
+ Project-URL: Documentation, https://docs.fxn.ai
209
+ Project-URL: Source, https://github.com/fxnai/fxn
210
+ Project-URL: Changelog, https://github.com/fxnai/fxn/blob/main/Changelog.md
211
+ Classifier: Programming Language :: Python :: 3
212
+ Classifier: License :: OSI Approved :: Apache Software License
213
+ Classifier: Operating System :: OS Independent
214
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
215
+ Classifier: Topic :: Software Development :: Libraries
216
+ Requires-Python: >=3.9
217
+ Description-Content-Type: text/markdown
218
+ License-File: LICENSE
219
+ Requires-Dist: aiohttp
220
+ Requires-Dist: magika
221
+ Requires-Dist: numpy
222
+ Requires-Dist: pillow
223
+ Requires-Dist: pydantic >=2.0
224
+ Requires-Dist: requests
225
+ Requires-Dist: rich
226
+ Requires-Dist: typer
227
+
228
+ # Function for Python and CLI
229
+
230
+ ![function logo](https://raw.githubusercontent.com/fxnai/.github/main/logo_wide.png)
231
+
232
+ [![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2Fy5vwgXkz2f%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&logo=discord&logoColor=white&label=Function%20community)](https://fxn.ai/community)
233
+
234
+ Run AI prediction functions (a.k.a "predictors") in your Python apps. With Function, you can build AI-powered apps by creating and composing GPU-accelerated predictors that run in the cloud. In a few steps:
235
+
236
+ ## Installing Function
237
+ Function is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). To install, open a terminal and run the following command:
238
+ ```sh
239
+ pip install --upgrade fxn
240
+ ```
241
+
242
+ > [!NOTE]
243
+ > Function requires Python 3.9+
244
+
245
+ ## Making a Prediction
246
+ Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
247
+
248
+ ### In Python
249
+ Run the following Python script:
250
+ ```py
251
+ from fxn import Function
252
+
253
+ # Create the Function client
254
+ fxn = Function()
255
+ # Create a prediction
256
+ prediction = fxn.predictions.create(
257
+ tag="@samplefxn/stable-diffusion",
258
+ inputs={
259
+ "prompt": "An astronaut riding a horse on Mars"
260
+ }
261
+ )
262
+ # Show the generated image
263
+ image = prediction.results[0]
264
+ image.show()
265
+ ```
266
+
267
+ ### In the CLI
268
+ Open up a terminal and run the following command:
269
+
270
+ ```sh
271
+ fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
272
+ ```
273
+
274
+ Within a few seconds, you should see a creepy-looking image pop up 😅:
275
+
276
+ ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
277
+
278
+ ## Creating a Predictor
279
+ At some point, you might want to create your own predictor. With Function, you don't have to deal with GitHub repos, Dockerfiles, or weird YAMLs. All you need is a Jupyter Notebook with a `predict` function. See our [samples project](https://github.com/fxnai/samples) for more.
280
+
281
+ ___
282
+
283
+ ## Useful Links
284
+ - [Discover predictors to use in your apps](https://fxn.ai/explore).
285
+ - [Join our Discord community](https://fxn.ai/community).
286
+ - [Check out our docs](https://docs.fxn.ai).
287
+ - Learn more about us [on our blog](https://blog.fxn.ai).
288
+ - Reach out to us at [hi@fxn.ai](mailto:hi@fxn.ai).
289
+
290
+ Function is a product of [NatML Inc](https://github.com/natmlx).
@@ -1,7 +1,7 @@
1
1
  fxn/__init__.py,sha256=tWk0-aCNHX_yCS-Dg90pYnniNka9MWFoNMk6xY7u4nI,157
2
2
  fxn/function.py,sha256=H2oviHGWfal2O7d386R8BZDMUZYdfOuMB7OijiPKo54,1632
3
3
  fxn/magic.py,sha256=PQmXhO9EvJ5EZylioV-6gsCvqhVRYscKBSOBoN4VhTk,1041
4
- fxn/version.py,sha256=sCV0ahdu4qRqz8naa1hMCcQb_IoDRqlzvAK_dLfFofQ,95
4
+ fxn/version.py,sha256=Cm-Vpzk1WviXo7P45Ih6JVS-3D75YtINDcAGDu6HOZw,95
5
5
  fxn/cli/__init__.py,sha256=gwMG0euV0qCe_vSvJLqBd6VWoQ99T-y4xQXeA4m4Wf0,1492
6
6
  fxn/cli/auth.py,sha256=MpHxhqPjGY92TmaTh3o58i868Cv-6Xgf13Si1NFluMg,1677
7
7
  fxn/cli/env.py,sha256=shqoP4tUiXdOoil73oiUYpqGeVcR119HPYFKgnoF894,1553
@@ -9,19 +9,21 @@ fxn/cli/misc.py,sha256=J3WgNjrxRzm-_iKC3Cp0o4VHeBYBQ1ta_t2-ozD9roo,662
9
9
  fxn/cli/predict.py,sha256=Q6oni_YScpBKRM1CuLK5jDAOORSfTcY6NLS5lC4a3jA,3259
10
10
  fxn/cli/predictors.py,sha256=Fg1yFvPgVnLORnQ3K_EWnGYw_lpkjTOA2l4W2wbXr08,4310
11
11
  fxn/graph/__init__.py,sha256=rJIDBhYg5jcrWO4hT4-CpwPq6dSgmLTEHCfUYTLpVaI,103
12
- fxn/graph/client.py,sha256=TRTgPatHq0nn-IkarBF93jEJ9-xltq-V9JJFIfHvqY4,1215
12
+ fxn/graph/client.py,sha256=WCNsebcuwIlP9W5k_8AQCpxOCcy7cpbengfu2rIkGmc,1192
13
13
  fxn/libs/__init__.py,sha256=c_q01PLV3Mi-qV0_HVbNRHOI2TIUr_cDIJHvCASsYZk,71
14
14
  fxn/libs/linux/__init__.py,sha256=c_q01PLV3Mi-qV0_HVbNRHOI2TIUr_cDIJHvCASsYZk,71
15
+ fxn/libs/macos/Function.dylib,sha256=sBr4As-U02V9GNeaO8oQlWDIJtKqW9YaSzP2p2wwT-Y,562176
15
16
  fxn/libs/macos/__init__.py,sha256=c_q01PLV3Mi-qV0_HVbNRHOI2TIUr_cDIJHvCASsYZk,71
17
+ fxn/libs/windows/Function.dll,sha256=QrK7DBkudqGCChpYtX5B8200QDLkMbLBBy3TURhcy-Q,427008
16
18
  fxn/libs/windows/__init__.py,sha256=c_q01PLV3Mi-qV0_HVbNRHOI2TIUr_cDIJHvCASsYZk,71
17
19
  fxn/services/__init__.py,sha256=OTBRL_wH94hc_scZgRd42VrJQfldNLjv4APN4YaWBAw,366
18
20
  fxn/services/environment.py,sha256=-K84dJhlQ_R13CPCqBMngdxSPP2jsgtNc_wBYx6dxjU,3716
19
- fxn/services/predictor.py,sha256=KtzckP0xsy6uoGATww4AbBQbEC9s2W6MDNrJFJx7rA8,7880
21
+ fxn/services/predictor.py,sha256=2thCKP6N6e7T-nXMoWPoDGGkYV2h4_BxrhXeHJoBP5M,7877
20
22
  fxn/services/storage.py,sha256=MY4in8XXVHDIpp8f928PFdujwegESb6m1zzop6d-z58,5517
21
23
  fxn/services/user.py,sha256=z7mencF-muknruaUuoleu6JoL-QsPJcrJ6ONT_6U7fk,1219
22
24
  fxn/services/prediction/__init__.py,sha256=TPox_z58SRjIvziCt1UnLNN1O23n_iF6HcmI0p9hwpQ,129
23
25
  fxn/services/prediction/fxnc.py,sha256=VIqEBCWl725NhuPek3t6GLOSWfva_faLxGOIDyKwa8A,12739
24
- fxn/services/prediction/service.py,sha256=K2IaKZgX-vlt81wNxGbElTbc5X1j2KnD3OwLRt90qCI,22188
26
+ fxn/services/prediction/service.py,sha256=axyKAU3cDBQvgvcLR9HDN2DQUQ0WKs-CWV7o-svkjhc,23110
25
27
  fxn/types/__init__.py,sha256=jHLpQnvUKGQujVPK3li1rIkANBBvw6l_EznzIsfoD88,438
26
28
  fxn/types/dtype.py,sha256=YpTnIG-yzrQwda27GzfGZcel-zF3gOMMoHhcWD915BY,617
27
29
  fxn/types/environment.py,sha256=FbmfGjSb5yYMT9IyDj8zNUpsoP3RbzqM6tK8gn2TfDs,394
@@ -32,9 +34,9 @@ fxn/types/storage.py,sha256=AtVKR3CtHzvSWLiJS_bbUyIA2Of_IKZVeL5_1PqqrQ0,228
32
34
  fxn/types/tag.py,sha256=hWzSDCo8VjRHjS5ZLuFi3xVo8cuCNaNeULQ2mHEuwzM,707
33
35
  fxn/types/user.py,sha256=_hc1YQh0WydniAurywA70EDs4VCY5rnGRYSiRc97Ab0,150
34
36
  fxn/types/value.py,sha256=_Euyb3ffydKV1Q68Mf2G9mz7gKD5NzFap-aX1NEuNuY,767
35
- fxn-0.0.31.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
36
- fxn-0.0.31.dist-info/METADATA,sha256=MqoupRlVZIx1KL_MZl1e_xww2HoN7kWU_rMlJIqZqWA,3340
37
- fxn-0.0.31.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
38
- fxn-0.0.31.dist-info/entry_points.txt,sha256=QBwKIRed76CRY98VYQYrQDVEBZtJugxJJmBpilxuios,46
39
- fxn-0.0.31.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
40
- fxn-0.0.31.dist-info/RECORD,,
37
+ fxn-0.0.33.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
38
+ fxn-0.0.33.dist-info/METADATA,sha256=2hLJEBl_09AGZjF6W4ppdRcf6nFj-7p1AXs6jv5x0Is,16309
39
+ fxn-0.0.33.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ fxn-0.0.33.dist-info/entry_points.txt,sha256=O_AwD5dYaeB-YT1F9hPAPuDYCkw_W0tdNGYbc5RVR2k,45
41
+ fxn-0.0.33.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
42
+ fxn-0.0.33.dist-info/RECORD,,
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  fxn = fxn.cli.__init__:app
3
-
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: fxn
3
- Version: 0.0.31
4
- Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
- Home-page: https://fxn.ai
6
- Author: NatML Inc.
7
- Author-email: hi@fxn.ai
8
- License: Apache License 2.0
9
- Project-URL: Documentation, https://docs.fxn.ai
10
- Project-URL: Source, https://github.com/fxnai/fxn
11
- Platform: UNKNOWN
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Topic :: Scientific/Engineering :: Image Recognition
16
- Classifier: Topic :: Software Development :: Libraries
17
- Requires-Python: >=3.9
18
- Description-Content-Type: text/markdown
19
- License-File: LICENSE
20
- Requires-Dist: aiohttp
21
- Requires-Dist: magika
22
- Requires-Dist: numpy
23
- Requires-Dist: pillow
24
- Requires-Dist: pydantic >=2.0
25
- Requires-Dist: requests
26
- Requires-Dist: rich
27
- Requires-Dist: typer
28
-
29
- # Function for Python and CLI
30
-
31
- ![function logo](https://raw.githubusercontent.com/fxnai/.github/main/logo_wide.png)
32
-
33
- [![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2Fy5vwgXkz2f%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&logo=discord&logoColor=white&label=Function%20community)](https://fxn.ai/community)
34
-
35
- Run AI prediction functions (a.k.a "predictors") in your Python apps. With Function, you can build AI-powered apps by creating and composing GPU-accelerated predictors that run in the cloud. In a few steps:
36
-
37
- ## Installing Function
38
- Function is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). To install, open a terminal and run the following command:
39
- ```sh
40
- pip install --upgrade fxn
41
- ```
42
-
43
- > [!NOTE]
44
- > Function requires Python 3.9+
45
-
46
- ## Making a Prediction
47
- Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
48
-
49
- ### In Python
50
- Run the following Python script:
51
- ```py
52
- from fxn import Function
53
-
54
- # Create the Function client
55
- fxn = Function()
56
- # Create a prediction
57
- prediction = fxn.predictions.create(
58
- tag="@samplefxn/stable-diffusion",
59
- inputs={
60
- "prompt": "An astronaut riding a horse on Mars"
61
- }
62
- )
63
- # Show the generated image
64
- image = prediction.results[0]
65
- image.show()
66
- ```
67
-
68
- ### In the CLI
69
- Open up a terminal and run the following command:
70
-
71
- ```sh
72
- fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
73
- ```
74
-
75
- Within a few seconds, you should see a creepy-looking image pop up 😅:
76
-
77
- ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
78
-
79
- ## Creating a Predictor
80
- At some point, you might want to create your own predictor. With Function, you don't have to deal with GitHub repos, Dockerfiles, or weird YAMLs. All you need is a Jupyter Notebook with a `predict` function. See our [samples project](https://github.com/fxnai/samples) for more.
81
-
82
- ___
83
-
84
- ## Useful Links
85
- - [Discover predictors to use in your apps](https://fxn.ai/explore).
86
- - [Join our Discord community](https://fxn.ai/community).
87
- - [Check out our docs](https://docs.fxn.ai).
88
- - Learn more about us [on our blog](https://blog.fxn.ai).
89
- - Reach out to us at [hi@fxn.ai](mailto:hi@fxn.ai).
90
-
91
- Function is a product of [NatML Inc](https://github.com/natmlx).
92
-
93
-
File without changes
File without changes