Skip to content

Commit

Permalink
Whitespace update
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed Jan 17, 2024
1 parent da2877a commit 4fe8505
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

# [
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/vision/captioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."


Expand Down
6 changes: 5 additions & 1 deletion docs/docs/vision/transformation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand All @@ -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)
Expand Down

0 comments on commit 4fe8505

Please sign in to comment.