-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d56fb6
commit 60cccf3
Showing
13 changed files
with
71 additions
and
67 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
|
||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.dtype_extensions import ImageArray | ||
from lotus.models import LM | ||
|
||
lotus.settings.configure(lm=LM(model="gpt-4o-mini")) | ||
|
||
# The images folder contain images representing digits taken from MNIST dataset | ||
image_file_names = os.listdir("images") # get all file in the folder | ||
|
||
# file names are the same as the digit represented by image | ||
labels = [os.path.splitext(image)[0] for image in image_file_names] | ||
image_paths = [os.path.join("images", image) for image in image_file_names] | ||
|
||
df = pd.DataFrame({"image": ImageArray(image_paths), "label": labels, "image_path": image_paths}) | ||
|
||
df = df.sem_filter("{image} represents number 1") | ||
print(df) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.dtype_extensions import ImageArray | ||
from lotus.models import LM | ||
|
||
lotus.settings.configure(lm=LM(model="gpt-4o-mini")) | ||
|
||
# The images folder contain images representing digits taken from MNIST dataset | ||
image_file_names = os.listdir("images") # get all file in the folder | ||
|
||
# file names are the same as the digit represented by image | ||
image_paths = [os.path.join("images", image) for image in image_file_names] | ||
|
||
image_df = pd.DataFrame({"image": ImageArray(image_paths), "image_path": image_paths}) | ||
labels_df = pd.DataFrame({"label": [0, 1]}) | ||
|
||
df = image_df.sem_join(labels_df, "{image} represents the number {label}", strategy="zs-cot") | ||
|
||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
|
||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.dtype_extensions import ImageArray | ||
from lotus.models import LM | ||
|
||
lotus.settings.configure(lm=LM(model="gpt-4o-mini")) | ||
|
||
# The images folder contain images representing digits taken from MNIST dataset | ||
image_file_names = os.listdir("images") # get all file in the folder | ||
|
||
# file names are the same as the digit represented by image | ||
labels = [os.path.splitext(image)[0] for image in image_file_names] | ||
image_paths = [os.path.join("images", image) for image in image_file_names] | ||
|
||
df = pd.DataFrame({"image": ImageArray(image_paths), "label": labels, "image_path": image_paths}) | ||
|
||
df = df.sem_map("convert {image} to the number it represents") | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters