295 lines
8.0 KiB
Plaintext
295 lines
8.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "56297249-4a8c-4e67-b8c3-a0d8652c104e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import modal"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "0d240622-8422-4c99-8464-c04d063e4cb6",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# !modal setup"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "3b133701-f550-44a1-a67f-eb7ccc4769a9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from hello import app, hello"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "0f3f73ae-1295-49f3-9099-b8b41fc3429b",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'Hello from Seaport, New York, US!!'"
|
|
]
|
|
},
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"with app.run(show_progress=False):\n",
|
|
" reply=hello.local()\n",
|
|
"reply"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "c1d8c6f9-edc7-4e52-9b3a-c07d7cff1ac7",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'Hello from Frankfurt am Main, Hesse, DE!!'"
|
|
]
|
|
},
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"with app.run(show_progress=False):\n",
|
|
" reply=hello.remote()\n",
|
|
"reply"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "cb8b6c41-8259-4329-b1c4-a1f67d26d1be",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import modal\n",
|
|
"from llama import app, generate"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "db4a718a-d95d-4f61-9688-c9df21d88fe6",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"with modal.enable_output():\n",
|
|
" with app.run():\n",
|
|
" result=generate.remote(\"Life is a mystery, everyone must stand alone, I hear\")\n",
|
|
"result"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "9a9a6844-29ec-4264-8e72-362d976b3968",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import modal\n",
|
|
"from pricer_ephemeral import app, price"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "50e6cf99-8959-4ae3-ba02-e325cb7fff94",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"with modal.enable_output():\n",
|
|
" with app.run():\n",
|
|
" result=price.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")\n",
|
|
"result"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "7f90d857-2f12-4521-bb90-28efd917f7d1",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"!modal deploy pricer_service"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "1dec70ff-1986-4405-8624-9bbbe0ce1f4a",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"pricer = modal.Function.lookup(\"pricer-service\", \"price\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "17776139-0d9e-4ad0-bcd0-82d3a92ca61f",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"pricer.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "58f5d19f-8ffc-496c-832b-04e0d5892f54",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import modal"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "f56d1e55-2a03-4ce2-bb47-2ab6b9175a02",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\u001b[2K\u001b[34m⠸\u001b[0m Creating objects.....\n",
|
|
"\u001b[38;5;244m└── \u001b[0m\u001b[34m⠋\u001b[0m Creating mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py: \n",
|
|
"\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[34m⠦\u001b[0m Creating objects...\n",
|
|
"\u001b[38;5;244m└── \u001b[0m\u001b[34m⠸\u001b[0m Creating mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py: \n",
|
|
"\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[34m⠏\u001b[0m Creating objects...\n",
|
|
"\u001b[38;5;244m└── \u001b[0m\u001b[34m⠦\u001b[0m Creating mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py: \n",
|
|
"\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[34m⠹\u001b[0m Creating objects...\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py\n",
|
|
"\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[34m⠴\u001b[0m Creating objects...load_model_to_folder.\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.download_model_to_folder.\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.*.\n",
|
|
"\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[34m⠴\u001b[0m Creating objects...\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.download_model_to_folder.\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.*.\n",
|
|
"\u001b[38;5;244m└── \u001b[0m🔨 Created function Pricer.price.\n",
|
|
"\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[1A\u001b[2K\u001b[32m✓\u001b[0m Created objects.\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created mount /Users/ed/dev/llm_engineering/week8/pricer_service2.py\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.download_model_to_folder.\n",
|
|
"\u001b[38;5;244m├── \u001b[0m🔨 Created function Pricer.*.\n",
|
|
"\u001b[38;5;244m└── \u001b[0m🔨 Created function Pricer.price.\n",
|
|
"\u001b[32m✓\u001b[0m App deployed in 1.570s! 🎉\n",
|
|
"\n",
|
|
"View Deployment: \u001b[35mhttps://modal.com/apps/ed-donner/main/deployed/pricer-service\u001b[0m\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"!modal deploy pricer_service2"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "9e19daeb-1281-484b-9d2f-95cc6fed2622",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"133.0\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"\n",
|
|
"import modal\n",
|
|
"\n",
|
|
"Pricer = modal.Cls.lookup(\"pricer-service\", \"Pricer\")\n",
|
|
"pricer = Pricer()\n",
|
|
"reply = pricer.price.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")\n",
|
|
"print(reply)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "ac331454-21e2-4b37-9602-4667006e34ee",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"reply = pricer.price.remote(\"iphone SE\")\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "c3a71dcd-b71d-4c48-b0d9-3ac296d2046a",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"299.0"
|
|
]
|
|
},
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"reply"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "ba9aedca-6a7b-4d30-9f64-59d76f76fb6d",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|