From 4fe85055ec9f2bf130e8fee9f513dbdb67519328 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Tue, 16 Jan 2024 22:48:20 -0500 Subject: [PATCH] Whitespace update --- README.md | 19 ++++++++++--------- docs/docs/vision/captioning.md | 3 ++- docs/docs/vision/transformation.md | 6 +++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index adb6fb4bd..5b93690ac 100644 --- a/README.md +++ b/README.md @@ -96,12 +96,14 @@ Learn more about classification [here](https://askmarvin.ai/docs/text/classifica Marvin can `extract` structured entities from text: ```python -from pydantic import BaseModel +import pydantic -class Location(BaseModel): + +class Location(pydantic.BaseModel): city: str state: str + marvin.extract("I moved from NY to CHI", target=Location) # [ @@ -129,12 +131,11 @@ Learn more about entity extraction [here](https://askmarvin.ai/docs/text/extract Marvin can `generate` synthetic data for you, following instructions and an optional schema: ```python -from pydantic import BaseModel - -class Location(BaseModel): +class Location(pydantic.BaseModel): city: str state: str + marvin.generate( n=4, target=Location, @@ -164,12 +165,11 @@ marvin.cast("one two three", list[int]) This is useful for standardizing text inputs or matching natural language to a schema: ```python -from pydantic import BaseModel - -class Location(BaseModel): +class Location(pydantic.BaseModel): city: str state: str + marvin.cast("The Big Apple", Location) # Location(city="New York", state="New York") @@ -179,10 +179,11 @@ For a class-based approach, Marvin's `@model` decorator can be applied to any Py ```python @marvin.model -class Location(BaseModel): +class Location(pydantic.BaseModel): city: str state: str + Location("The Big Apple") # Location(city="New York", state="New York") diff --git a/docs/docs/vision/captioning.md b/docs/docs/vision/captioning.md index 3234caf7b..cf9abe54e 100644 --- a/docs/docs/vision/captioning.md +++ b/docs/docs/vision/captioning.md @@ -25,10 +25,11 @@ Marvin can use OpenAI's vision API to process images as inputs. import marvin from pathlib import Path - marvin.beta.caption(image=Path('/path/to/marvin.png')) + caption = marvin.beta.caption(image=Path('/path/to/marvin.png')) ``` !!! success "Result" + "This is a digital illustration featuring a stylized, cute character resembling a Funko Pop vinyl figure with large, shiny eyes and a square-shaped head, sitting on abstract wavy shapes that simulate a landscape. The whimsical figure is set against a dark background with sparkling, colorful bokeh effects, giving it a magical, dreamy atmosphere." diff --git a/docs/docs/vision/transformation.md b/docs/docs/vision/transformation.md index 4d85ea46a..950354afc 100644 --- a/docs/docs/vision/transformation.md +++ b/docs/docs/vision/transformation.md @@ -41,10 +41,12 @@ The `marvin.beta.cast` function is an enhanced version of `marvin.cast` that acc import marvin from pydantic import BaseModel, Field + class Location(BaseModel): city: str state: str = Field(description="2-letter state abbreviation") - + + img = marvin.beta.Image('https://images.unsplash.com/photo-1568515387631-8b650bbcdb90') result = marvin.beta.cast(img, target=Location) ``` @@ -67,10 +69,12 @@ The `marvin.beta.cast` function is an enhanced version of `marvin.cast` that acc import marvin from pydantic import BaseModel + class Book(BaseModel): title: str subtitle: str authors: list[str] + img = marvin.beta.Image('https://hastie.su.domains/ElemStatLearn/CoverII_small.jpg') result = marvin.beta.cast(img, target=Book)