fxn 0.0.15__py3-none-any.whl → 0.0.16__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/cli/predict.py CHANGED
@@ -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:
fxn/version.py CHANGED
@@ -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.
@@ -33,33 +33,35 @@ Run AI prediction functions (a.k.a "predictors") in your Python apps. With Funct
33
33
  ## Installing Function
34
34
  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:
35
35
  ```sh
36
- pip install fxn
36
+ pip install --upgrade fxn
37
37
  ```
38
38
 
39
39
  > Note that Function requires Python 3.9+
40
40
 
41
- ## Signing in to Function
42
- Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
43
-
44
- ![generate access key](https://raw.githubusercontent.com/fxnai/.github/main/access_key.gif)
45
-
46
- Now, let's login to the Function CLI with your access key. Open a terminal and run the following command:
47
- ```sh
48
- fxn auth login <ACCESS KEY>
41
+ ## Making a Prediction
42
+ Let's run the [`@samplefxn/stable-diffusion`](https://fxn.ai/@samplefxn/stable-diffusion) predictor which accepts a text `prompt` and generates a corresponding image.
43
+
44
+ ### In Python
45
+ Run the following Python script:
46
+ ```py
47
+ import fxn
48
+
49
+ prediction = fxn.Prediction.create(
50
+ tag="@samplefxn/stable-diffusion",
51
+ prompt="An astronaut riding a horse on Mars"
52
+ )
53
+ image = prediction.results[0]
54
+ image.show()
49
55
  ```
50
56
 
51
- You should see information about your Function account:
52
-
53
- ![login to CLI](https://raw.githubusercontent.com/fxnai/.github/main/auth_login.gif)
54
-
55
- ## Making a Prediction
56
- 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:
57
+ ### In the CLI
58
+ Open up a terminal and run the following command:
57
59
 
58
60
  ```sh
59
- fxn predict @natml/stable-diffusion --prompt "An astronaut riding a horse on the moon"
61
+ fxn predict @samplefxn/stable-diffusion --prompt "An astronaut riding a horse on the moon"
60
62
  ```
61
63
 
62
- And within a few seconds, you should see a creepy-looking image pop up 😅:
64
+ Within a few seconds, you should see a creepy-looking image pop up 😅:
63
65
 
64
66
  ![prediction](https://raw.githubusercontent.com/fxnai/.github/main/predict.gif)
65
67
 
@@ -1,6 +1,6 @@
1
1
  fxn/__init__.py,sha256=0NzZl5hRQ0MPNN4Wp9-ghqak2NJzhfHvVyBGX-IntKs,320
2
2
  fxn/magic.py,sha256=TRgE68OAo1djmeQRiqxnSJqa72td6zxnwo0s0bkdUKM,1041
3
- fxn/version.py,sha256=3OK-QR3joAr7h4-0cJiXXXmjS7nKU-UrxqfaU1n-DqU,95
3
+ fxn/version.py,sha256=PVMyxP-O98TEP8WlKBEi04kzavQs4NlWxAjlIIBJ86w,95
4
4
  fxn/api/__init__.py,sha256=UcCERjadfSbqnt7urXYbrdRRFwA0QwpC9uBQYPJC5rE,460
5
5
  fxn/api/api.py,sha256=X2LRjer0s7ifecYsZmdqv5txEwPjA2ekdSCGUaQJ5So,927
6
6
  fxn/api/dtype.py,sha256=z9zjjsOk8X8LTCEpwLuWOTUys6nP_3L6VmZXLt0ilAY,617
@@ -16,11 +16,11 @@ fxn/cli/__init__.py,sha256=5-yqKCUJCiNTA_7EHfCj5GZKthIQSdbPcVAdMnzYNLg,1492
16
16
  fxn/cli/auth.py,sha256=_5rZ9L-blD39U6-SgHV9V2ltyjJ7k32NY3bLvoGsaNc,1659
17
17
  fxn/cli/env.py,sha256=mnyaL27n59pCU-p2Jm1fo03se7btMV2zdoJWWVshF_M,1658
18
18
  fxn/cli/misc.py,sha256=gLEGGWyawUQaLOuy8bfS2wrJuS-tN-bleOrv5A07xck,690
19
- fxn/cli/predict.py,sha256=Tfo-weSusIka33NQf8-iI3liH7RfYgs1195v2ikjI8s,2842
19
+ fxn/cli/predict.py,sha256=QPNmwLAF8KndaVSS2vt0OBB-UoRn0VHgM2CNmIN6EEw,3180
20
20
  fxn/cli/predictors.py,sha256=vAL1FioQSseEiu7jbXY0DRiHnnMmThK2csJLThizS7A,3481
21
- fxn-0.0.15.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
22
- fxn-0.0.15.dist-info/METADATA,sha256=FOIhE1rmbTUOrKQRjkeYdc0UU33XFUVAD8J1ds6Dy00,3213
23
- fxn-0.0.15.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
24
- fxn-0.0.15.dist-info/entry_points.txt,sha256=QBwKIRed76CRY98VYQYrQDVEBZtJugxJJmBpilxuios,46
25
- fxn-0.0.15.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
26
- fxn-0.0.15.dist-info/RECORD,,
21
+ fxn-0.0.16.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
22
+ fxn-0.0.16.dist-info/METADATA,sha256=guWZoXVbaAkQGXgtuCLx6UJ5tL4wCf4kzMpQDPs3GYo,2887
23
+ fxn-0.0.16.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
24
+ fxn-0.0.16.dist-info/entry_points.txt,sha256=QBwKIRed76CRY98VYQYrQDVEBZtJugxJJmBpilxuios,46
25
+ fxn-0.0.16.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
26
+ fxn-0.0.16.dist-info/RECORD,,
File without changes
File without changes