Skip to content

Commit 8049ece

Browse files
committed
Update contexttab snippets
1 parent 478e81f commit 8049ece

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH)
132132
ta.save("test-2.wav", wav, model.sr)`,
133133
];
134134

135-
export const contexttab = (): string[] => [
136-
`# pip install git+https://github.com/SAP-samples/contexttab
135+
export const contexttab = (): string[] => {
136+
const installSnippet = `pip install git+https://github.com/SAP-samples/contexttab`;
137137

138-
# Run a classification task
138+
const classificationSnippet = `# Run a classification task
139139
from sklearn.datasets import load_breast_cancer
140140
from sklearn.metrics import accuracy_score
141141
from sklearn.model_selection import train_test_split
@@ -155,9 +155,9 @@ clf.fit(X_train, y_train)
155155
prediction_probabilities = clf.predict_proba(X_test)
156156
# Predict labels
157157
predictions = clf.predict(X_test)
158-
print("Accuracy", accuracy_score(y_test, predictions))
158+
print("Accuracy", accuracy_score(y_test, predictions))`;
159159

160-
# Run a regression task
160+
const regressionsSnippet = `# Run a regression task
161161
from sklearn.datasets import fetch_openml
162162
from sklearn.metrics import r2_score
163163
from sklearn.model_selection import train_test_split
@@ -182,8 +182,9 @@ regressor.fit(X_train, y_train)
182182
predictions = regressor.predict(X_test)
183183
184184
r2 = r2_score(y_test, predictions)
185-
print("R² Score:", r2)`,
186-
];
185+
print("R² Score:", r2)`;
186+
return [installSnippet, classificationSnippet, regressionsSnippet];
187+
};
187188

188189

189190
export const cxr_foundation = (): string[] => [

0 commit comments

Comments
 (0)