Skip to content

Commit b46b986

Browse files
Merge pull request #32 from mlrun/main
merge main
2 parents 991fce8 + 1602256 commit b46b986

File tree

4 files changed

+46
-66
lines changed

4 files changed

+46
-66
lines changed

env.template

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
S3_BUCKET_NAME=
21
OPENAI_API_BASE=
3-
OPENAI_API_KEY=
2+
OPENAI_API_KEY=
3+
#for platform Iguazio, you need to set the MYSQL_URL and remove S3_BUCKET_NAME
4+
MYSQL_URL=
5+
#for platform Mck, you need to set the S3_BUCKET_NAME and remove MYSQL_URL
6+
S3_BUCKET_NAME=

mlrun.env

Lines changed: 0 additions & 21 deletions
This file was deleted.

notebook.ipynb

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": 1,
54+
"execution_count": null,
5555
"id": "aed64e7c-1706-4a78-89ff-75b8a382472a",
5656
"metadata": {
5757
"jupyter": {
@@ -62,7 +62,7 @@
6262
},
6363
"outputs": [],
6464
"source": [
65-
"# !pip install SQLAlchemy==2.0.31 pymysql"
65+
"!pip install SQLAlchemy==2.0.31 pymysql dotenv"
6666
]
6767
},
6868
{
@@ -90,7 +90,8 @@
9090
"- This demo is limited to run with MLRun 1.9.x Python 3.11, with CPU, a mysql database and run the pipeline with `engine = \"remote\"`.\n",
9191
"- GPU is not supported at the moment.\n",
9292
"- Need to setup a mysql database for the demo. sqlite is not supported now.\n",
93-
"- Please set `run_with_gpu = False`, `use_sqlite = False`, `engine = \"remote\"`"
93+
"- Please set `run_with_gpu = False`, `use_sqlite = False`, `engine = \"remote\"`\n",
94+
"- .env include OPENAI_API_KEY, OPENAI_API_BASE, and MYSQL_URL"
9495
]
9596
},
9697
{
@@ -108,7 +109,8 @@
108109
"source": [
109110
"- GPU is not supported at the moment.\n",
110111
"- sqlite is supported.\n",
111-
"- Please set `run_with_gpu = False`, `use_sqlite = True`, `engine = \"remote\"`"
112+
"- Please set `run_with_gpu = False`, `use_sqlite = True`, `engine = \"remote\"`\n",
113+
"- .env include OPENAI_API_KEY, OPENAI_API_BASE, and S3_BUCKET_NAME"
112114
]
113115
},
114116
{
@@ -140,21 +142,20 @@
140142
},
141143
{
142144
"cell_type": "code",
143-
"execution_count": null,
145+
"execution_count": 1,
144146
"id": "76f05c23312057a3",
145147
"metadata": {},
146148
"outputs": [],
147149
"source": [
148150
"# True = run with GPU, False = run with CPU\n",
149151
"run_with_gpu = False\n",
150152
"language = \"en\" # The languages of the calls, es - Spanish, en - English\n",
151-
"skip_calls_generation = False\n",
152-
"use_sqlite = False"
153+
"skip_calls_generation = False"
153154
]
154155
},
155156
{
156157
"cell_type": "code",
157-
"execution_count": null,
158+
"execution_count": 2,
158159
"id": "7e7503f4-8830-4972-a986-10f4c29624b9",
159160
"metadata": {
160161
"tags": []
@@ -166,7 +167,7 @@
166167
"True"
167168
]
168169
},
169-
"execution_count": 3,
170+
"execution_count": 2,
170171
"metadata": {},
171172
"output_type": "execute_result"
172173
}
@@ -176,7 +177,6 @@
176177
"import os\n",
177178
"import sys\n",
178179
"import mlrun\n",
179-
"\n",
180180
"dotenv_file = \".env\"\n",
181181
"sys.path.insert(0, os.path.abspath(\"./\"))\n",
182182
"\n",
@@ -185,7 +185,7 @@
185185
},
186186
{
187187
"cell_type": "code",
188-
"execution_count": 4,
188+
"execution_count": 3,
189189
"id": "d33fc614-2898-4b12-b34f-62181651a9b5",
190190
"metadata": {},
191191
"outputs": [],
@@ -195,6 +195,20 @@
195195
"assert os.environ[\"OPENAI_API_KEY\"]"
196196
]
197197
},
198+
{
199+
"cell_type": "code",
200+
"execution_count": 4,
201+
"id": "9e2a5fd0-f4ff-486a-9d22-e5b80b7eb2a4",
202+
"metadata": {},
203+
"outputs": [],
204+
"source": [
205+
"if not mlrun.mlconf.is_ce_mode():\n",
206+
" assert os.environ[\"MYSQL_URL\"]\n",
207+
" use_sqlite = False\n",
208+
"else:\n",
209+
" use_sqlite = True"
210+
]
211+
},
198212
{
199213
"cell_type": "markdown",
200214
"id": "1ea33fee-ec95-48e3-aae8-9247ae182481",
@@ -230,7 +244,6 @@
230244
"execution_count": null,
231245
"id": "80b388f8-5aa3-4b6a-9b6d-b6dca242165e",
232246
"metadata": {
233-
"scrolled": true,
234247
"tags": []
235248
},
236249
"outputs": [],
@@ -239,6 +252,7 @@
239252
"project = mlrun.get_or_create_project(\n",
240253
" name=project_name,\n",
241254
" user_project=False,\n",
255+
" allow_cross_project=True,\n",
242256
" parameters={\n",
243257
" \"build_image\": True,\n",
244258
" \"source\": \"git://github.com/mlrun/demo-call-center.git#main\",\n",
@@ -296,7 +310,7 @@
296310
},
297311
{
298312
"cell_type": "code",
299-
"execution_count": 6,
313+
"execution_count": 14,
300314
"id": "adc25213-d4d6-411d-a9b0-edf91007ba33",
301315
"metadata": {},
302316
"outputs": [],
@@ -343,21 +357,10 @@
343357
},
344358
{
345359
"cell_type": "code",
346-
"execution_count": 7,
360+
"execution_count": null,
347361
"id": "8d3d7cca-ff52-4ffd-98df-7d70e8b083cf",
348362
"metadata": {},
349-
"outputs": [
350-
{
351-
"data": {
352-
"text/plain": [
353-
"<mlrun.projects.project.MlrunProject at 0x7fa2d60f05d0>"
354-
]
355-
},
356-
"execution_count": 7,
357-
"metadata": {},
358-
"output_type": "execute_result"
359-
}
360-
],
363+
"outputs": [],
361364
"source": [
362365
"project.spec.params['build_image']=False\n",
363366
"project.save()"
@@ -555,21 +558,12 @@
555558
},
556559
{
557560
"cell_type": "code",
558-
"execution_count": 15,
561+
"execution_count": null,
559562
"id": "399ed9c3-2765-4f03-a812-79428e51149e",
560563
"metadata": {
561564
"tags": []
562565
},
563-
"outputs": [
564-
{
565-
"name": "stdout",
566-
"output_type": "stream",
567-
"text": [
568-
"> 2025-08-18 03:40:34,753 [info] downloading s3://igz1-xingsheng-medium-r/projects/call-center-demo/artifacts/582022de-ef13-47b9-8b63-dbcf8680135e/text-to-audio/0/audio_files.zip to local temp file\n",
569-
"> 2025-08-18 03:40:37,898 [info] downloading s3://igz1-xingsheng-medium-r/projects/call-center-demo/artifacts/582022de-ef13-47b9-8b63-dbcf8680135e/conversation-generation/0/conversations.zip to local temp file\n"
570-
]
571-
}
572-
],
566+
"outputs": [],
573567
"source": [
574568
"import zipfile\n",
575569
"\n",
@@ -669,9 +663,9 @@
669663
],
670664
"metadata": {
671665
"kernelspec": {
672-
"display_name": "mlrun",
666+
"display_name": "py311",
673667
"language": "python",
674-
"name": "mlrun"
668+
"name": "conda-env-.conda-py311-py"
675669
},
676670
"language_info": {
677671
"codemirror_mode": {

project_setup.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def setup(
5050
if use_sqlite:
5151
# uploading db file to s3:
5252
if CE_MODE:
53-
s3 = boto3.client("s3") if not os.getenv("S3_ENDPOINT_URL") else boto3.client('s3', endpoint_url=os.getenv("S3_ENDPOINT_URL"))
53+
s3 = boto3.client("s3") if not os.getenv("AWS_ENDPOINT_URL_S3") else boto3.client('s3', endpoint_url=os.getenv("AWS_ENDPOINT_URL_S3"))
5454
bucket_name = Path(mlrun.mlconf.artifact_path).parts[1]
5555
# Upload the file
5656
s3.upload_file(
@@ -150,11 +150,15 @@ def _build_image(project: mlrun.projects.MlrunProject, with_gpu: bool, default_i
150150
] if with_gpu else []
151151

152152
other_requirements = [
153-
"pip install mlrun langchain==0.2.17 openai==1.58.1 langchain_community==0.2.19 pydub==0.25.1 streamlit==1.28.0 st-annotated-text==4.0.1 spacy==3.7.2 librosa==0.10.1 presidio-anonymizer==2.2.34 presidio-analyzer==2.2.34 nltk==3.8.1 flair==0.13.0 htbuilder==0.6.2",
154-
"python -m spacy download en_core_web_lg",
153+
"pip install mlrun langchain==0.2.17 openai==1.58.1 langchain_community==0.2.19 pydub==0.25.1 streamlit==1.28.0 st-annotated-text==4.0.1 spacy==3.7.1 librosa==0.10.1 presidio-anonymizer==2.2.34 presidio-analyzer==2.2.34 nltk==3.8.1 flair==0.13.0 htbuilder==0.6.2",
154+
"pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.7.1/en_core_web_lg-3.7.1.tar.gz",
155+
# "python -m spacy download en_core_web_lg",
156+
155157
"pip install SQLAlchemy==2.0.31 pymysql requests_toolbelt==0.10.1",
156158
"pip uninstall -y onnxruntime-gpu onnxruntime",
157159
f"pip install {config['onnx_package']}",
160+
"pip uninstall -y protobuf",
161+
"pip install protobuf"
158162
]
159163

160164
# Combine commands in the required order
@@ -357,4 +361,4 @@ def _set_workflows(project: mlrun.projects.MlrunProject, image):
357361
)
358362
project.set_workflow(
359363
name="calls-analysis", workflow_path="./src/workflows/calls_analysis.py", image=image
360-
)
364+
)

0 commit comments

Comments
 (0)