Skip to content

Commit e40667b

Browse files
authored
Update evaluate.py
This modification replaces the IPython import with a try-except block. If IPython is not available, it sets ipython_display to the built-in print function and defines a dummy HTML lambda function.
1 parent 125325f commit e40667b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dspy/evaluate/evaluate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import threading
44
import pandas as pd
55

6-
from IPython.display import display as ipython_display, HTML
6+
try:
7+
from IPython.display import display as ipython_display, HTML
8+
except ImportError:
9+
ipython_display = print
10+
HTML = lambda x: x
711
from concurrent.futures import ThreadPoolExecutor, as_completed
812

913
from dsp.utils import EM
@@ -206,4 +210,4 @@ def configure_dataframe_display(df, metric_name):
206210
})
207211

208212
# FIXME: TODO: The merge_dicts stuff above is way too quick and dirty.
209-
# TODO: the display_table can't handle False but can handle 0! Not sure how it works with True exactly, probably fails too.
213+
# TODO: the display_table can't handle False but can handle 0! Not sure how it works with True exactly, probably fails too.

0 commit comments

Comments
 (0)