fxn 0.0.15__tar.gz → 0.0.16__tar.gz

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.
Files changed (31) hide show
  1. {fxn-0.0.15 → fxn-0.0.16}/PKG-INFO +20 -18
  2. {fxn-0.0.15 → fxn-0.0.16}/README.md +19 -17
  3. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/predict.py +15 -8
  4. {fxn-0.0.15 → fxn-0.0.16}/fxn/version.py +1 -1
  5. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/PKG-INFO +20 -18
  6. {fxn-0.0.15 → fxn-0.0.16}/LICENSE +0 -0
  7. {fxn-0.0.15 → fxn-0.0.16}/fxn/__init__.py +0 -0
  8. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/__init__.py +0 -0
  9. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/api.py +0 -0
  10. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/dtype.py +0 -0
  11. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/environment.py +0 -0
  12. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/prediction.py +0 -0
  13. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/predictor.py +0 -0
  14. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/profile.py +0 -0
  15. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/storage.py +0 -0
  16. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/tag.py +0 -0
  17. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/user.py +0 -0
  18. {fxn-0.0.15 → fxn-0.0.16}/fxn/api/value.py +0 -0
  19. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/__init__.py +0 -0
  20. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/auth.py +0 -0
  21. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/env.py +0 -0
  22. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/misc.py +0 -0
  23. {fxn-0.0.15 → fxn-0.0.16}/fxn/cli/predictors.py +0 -0
  24. {fxn-0.0.15 → fxn-0.0.16}/fxn/magic.py +0 -0
  25. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/SOURCES.txt +0 -0
  26. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/dependency_links.txt +0 -0
  27. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/entry_points.txt +0 -0
  28. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/requires.txt +0 -0
  29. {fxn-0.0.15 → fxn-0.0.16}/fxn.egg-info/top_level.txt +0 -0
  30. {fxn-0.0.15 → fxn-0.0.16}/setup.cfg +0 -0
  31. {fxn-0.0.15 → fxn-0.0.16}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
5
  Home-page: https://fxn.ai
6
6
  Author: NatML Inc.
@@ -27,33 +27,35 @@ Run AI prediction functions (a.k.a "predictors") in your Python apps. With Funct
27
27
  ## Installing Function
28
28
  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:
29
29
  ```sh
30
- pip install fxn
30
+ pip install --upgrade fxn
31
31
  ```
32
32
 
33
33
  > Note that Function requires Python 3.9+
34
34
 
35
- ## Signing in to Function
36
- Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
37
-
38
- ![generate access key](https://raw.githubusercontent.com/fxnai/.github/main/access_key.gif)
39
-
40
- Now, let's login to the Function CLI with your access key. Open a terminal and run the following command:
41
- ```sh
42
- fxn auth login <ACCESS KEY>
35
+ ## Making a Prediction
36
+ Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
37
+
38
+ ### In Python
39
+ Run the following Python script:
40
+ ```py
41
+ import fxn
42
+
43
+ prediction = fxn.Prediction.create(
44
+ tag="@samplefxn/stable-diffusion",
45
+ prompt="An astronaut riding a horse on Mars"
46
+ )
47
+ image = prediction.results[0]
48
+ image.show()
43
49
  ```
44
50
 
45
- You should see information about your Function account:
46
-
47
- ![login to CLI](https://raw.githubusercontent.com/fxnai/.github/main/auth_login.gif)
48
-
49
- ## Making a Prediction
50
- You can start off by running an existing predictor [on Function](https://fxn.ai/explore). Let's run the [`@natml/stable-diffusion`](https://fxn.ai/@natml/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image. In terminal, run the following command:
51
+ ### In the CLI
52
+ Open up a terminal and run the following command:
51
53
 
52
54
  ```sh
53
- fxn predict @natml/stable-diffusion --prompt "An astronaut riding a horse on the moon"
55
+ fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
54
56
  ```
55
57
 
56
- And within a few seconds, you should see a creepy-looking image pop up 😅:
58
+ Within a few seconds, you should see a creepy-looking image pop up 😅:
57
59
 
58
60
  ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
59
61
 
@@ -7,33 +7,35 @@ Run AI prediction functions (a.k.a "predictors") in your Python apps. With Funct
7
7
  ## Installing Function
8
8
  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:
9
9
  ```sh
10
- pip install fxn
10
+ pip install --upgrade fxn
11
11
  ```
12
12
 
13
13
  > Note that Function requires Python 3.9+
14
14
 
15
- ## Signing in to Function
16
- Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
17
-
18
- ![generate access key](https://raw.githubusercontent.com/fxnai/.github/main/access_key.gif)
19
-
20
- Now, let's login to the Function CLI with your access key. Open a terminal and run the following command:
21
- ```sh
22
- fxn auth login <ACCESS KEY>
15
+ ## Making a Prediction
16
+ Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
17
+
18
+ ### In Python
19
+ Run the following Python script:
20
+ ```py
21
+ import fxn
22
+
23
+ prediction = fxn.Prediction.create(
24
+ tag="@samplefxn/stable-diffusion",
25
+ prompt="An astronaut riding a horse on Mars"
26
+ )
27
+ image = prediction.results[0]
28
+ image.show()
23
29
  ```
24
30
 
25
- You should see information about your Function account:
26
-
27
- ![login to CLI](https://raw.githubusercontent.com/fxnai/.github/main/auth_login.gif)
28
-
29
- ## Making a Prediction
30
- You can start off by running an existing predictor [on Function](https://fxn.ai/explore). Let's run the [`@natml/stable-diffusion`](https://fxn.ai/@natml/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image. In terminal, run the following command:
31
+ ### In the CLI
32
+ Open up a terminal and run the following command:
31
33
 
32
34
  ```sh
33
- fxn predict @natml/stable-diffusion --prompt "An astronaut riding a horse on the moon"
35
+ fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
34
36
  ```
35
37
 
36
- And within a few seconds, you should see a creepy-looking image pop up 😅:
38
+ Within a few seconds, you should see a creepy-looking image pop up 😅:
37
39
 
38
40
  ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
39
41
 
@@ -9,6 +9,7 @@ from numpy import ndarray
9
9
  from pathlib import Path, PurePath
10
10
  from PIL import Image
11
11
  from rich import print_json
12
+ from rich.progress import Progress, SpinnerColumn, TextColumn
12
13
  from tempfile import mkstemp
13
14
  from typer import Argument, Context, Option
14
15
 
@@ -21,14 +22,20 @@ def predict (
21
22
  context: Context = 0
22
23
  ):
23
24
  # Predict
24
- inputs = { context.args[i].replace("-", ""): _parse_value(context.args[i+1]) for i in range(0, len(context.args), 2) }
25
- prediction = Prediction.create(
26
- tag=tag,
27
- **inputs,
28
- raw_outputs=raw_outputs,
29
- return_binary_path=True,
30
- access_key=get_access_key()
31
- )
25
+ with Progress(
26
+ SpinnerColumn(spinner_name="point"),
27
+ TextColumn("[progress.description]{task.description}"),
28
+ transient=True
29
+ ) as progress:
30
+ progress.add_task(description="Making prediction...", total=None)
31
+ inputs = { context.args[i].replace("-", ""): _parse_value(context.args[i+1]) for i in range(0, len(context.args), 2) }
32
+ prediction = Prediction.create(
33
+ tag=tag,
34
+ **inputs,
35
+ raw_outputs=raw_outputs,
36
+ return_binary_path=True,
37
+ access_key=get_access_key()
38
+ )
32
39
  # Parse results
33
40
  images = []
34
41
  if hasattr(prediction, "results") and prediction.results is not None:
@@ -3,4 +3,4 @@
3
3
  # Copyright © 2023 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- __version__ = "0.0.15"
6
+ __version__ = "0.0.16"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary: Run on-device and cloud AI prediction functions in Python. Register at https://fxn.ai.
5
5
  Home-page: https://fxn.ai
6
6
  Author: NatML Inc.
@@ -27,33 +27,35 @@ Run AI prediction functions (a.k.a "predictors") in your Python apps. With Funct
27
27
  ## Installing Function
28
28
  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:
29
29
  ```sh
30
- pip install fxn
30
+ pip install --upgrade fxn
31
31
  ```
32
32
 
33
33
  > Note that Function requires Python 3.9+
34
34
 
35
- ## Signing in to Function
36
- Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
37
-
38
- ![generate access key](https://raw.githubusercontent.com/fxnai/.github/main/access_key.gif)
39
-
40
- Now, let's login to the Function CLI with your access key. Open a terminal and run the following command:
41
- ```sh
42
- fxn auth login <ACCESS KEY>
35
+ ## Making a Prediction
36
+ Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
37
+
38
+ ### In Python
39
+ Run the following Python script:
40
+ ```py
41
+ import fxn
42
+
43
+ prediction = fxn.Prediction.create(
44
+ tag="@samplefxn/stable-diffusion",
45
+ prompt="An astronaut riding a horse on Mars"
46
+ )
47
+ image = prediction.results[0]
48
+ image.show()
43
49
  ```
44
50
 
45
- You should see information about your Function account:
46
-
47
- ![login to CLI](https://raw.githubusercontent.com/fxnai/.github/main/auth_login.gif)
48
-
49
- ## Making a Prediction
50
- You can start off by running an existing predictor [on Function](https://fxn.ai/explore). Let's run the [`@natml/stable-diffusion`](https://fxn.ai/@natml/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image. In terminal, run the following command:
51
+ ### In the CLI
52
+ Open up a terminal and run the following command:
51
53
 
52
54
  ```sh
53
- fxn predict @natml/stable-diffusion --prompt "An astronaut riding a horse on the moon"
55
+ fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
54
56
  ```
55
57
 
56
- And within a few seconds, you should see a creepy-looking image pop up 😅:
58
+ Within a few seconds, you should see a creepy-looking image pop up 😅:
57
59
 
58
60
  ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
59
61
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes