{ "cells": [ { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "┌─ Modal Deprecation Warning (2025-02-06) ────────────────────────────────────┐\n", "│ Using Python module paths will require using the -m flag in a future │\n", "│ version of Modal. │\n", "│ Use `modal deploy -m classifier_modal` instead. │\n", "└─────────────────────────────────────────────────────────────────────────────┘\n", "┌─ Modal Deprecation Warning (2025-01-15) ────────────────────────────────────┐\n", "│ The `@modal.build` decorator is deprecated and will be removed in a future │\n", "│ release. │\n", "│ │\n", "│ We now recommend storing large assets (such as model weights) using a │\n", "│ `modal.Volume` instead of writing them directly into the `modal.Image` │\n", "│ filesystem. For other use cases we recommend using `Image.run_function` │\n", "│ instead. │\n", "│ │\n", "│ See https://modal.com/docs/guide/modal-1-0-migration for more information. │\n", "│ │\n", "│ Source: c:\\LLM\\AccentDetector\\classifier_modal.py:12 │\n", "│ @modal.build() │\n", "└─────────────────────────────────────────────────────────────────────────────┘\n", "- Creating objects...\n", "\\ Creating objects...\n", "└── - Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n", " files\n", "/ Creating objects...\n", "└── | Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n", " files\n", "\\ Creating objects...\n", "└── / Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n", " files\n", "/ Creating objects...\n", "└── \\ Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Finalizing \n", " index of 1 files\n", "\\ Creating objects...\n", "├── 🔨 Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n", "└── 🔨 Created function Accentizer.download_model.\n", "/ Creating objects...\n", "├── 🔨 Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n", "├── 🔨 Created function Accentizer.download_model.\n", "└── - Creating function Accentizer.*...\n", "\\ Creating objects...\n", "├── 🔨 Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n", "├── 🔨 Created function Accentizer.download_model.\n", "└── 🔨 Created function Accentizer.*.\n", "\\ Creating objects...\n", "├── 🔨 Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n", "├── 🔨 Created function Accentizer.download_model.\n", "└── 🔨 Created function Accentizer.*.\n", "\n", "✓ Created objects.\n", "├── 🔨 Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n", "├── 🔨 Created function Accentizer.download_model.\n", "└── 🔨 Created function Accentizer.*.\n", "✓ App deployed in 2.520s! 🎉\n", "\n", "View Deployment: \n", "https://modal.com/apps/djallelbrahmia/main/deployed/ClassifierAudio\n" ] } ], "source": [ "!modal deploy classifier_modal" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Python312\\Lib\\asyncio\\events.py:88: DeprecationError: 2025-01-27: `modal.Cls.lookup` is deprecated and will be removed in a future release. It can be replaced with `modal.Cls.from_name`.\n", "\n", "See https://modal.com/docs/guide/modal-1-0-migration for more information.\n", " self._context.run(self._callback, *self._args)\n", "C:\\Users\\dbrah\\AppData\\Local\\Temp\\ipykernel_62300\\1972719297.py:5: DeprecationError: 2025-01-13: Calling a method on an uninstantiated class will soon be deprecated; update your code to instantiate the class first, i.e.:\n", "Accentizer().classify instead of Accentizer.classify\n", " result=Accentizer.classify.remote(link)\n" ] } ], "source": [ "import modal\n", "import torch\n", "link=\"https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav\"\n", "Accentizer = modal.Cls.lookup(\"ClassifierAudio\", \"Accentizer\")\n", "result=Accentizer.classify.remote(link)" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'label': ['malaysia'],\n", " 'score': tensor([1.0000]),\n", " 'index': tensor([11]),\n", " 'out_prob': tensor([[1.1861e-06, 1.2054e-10, 5.3472e-11, 5.4380e-13, 2.0032e-15, 4.4907e-07,\n", " 6.3840e-15, 4.1447e-15, 6.7380e-18, 1.5645e-16, 2.8600e-14, 1.0000e+00,\n", " 9.1363e-11, 1.0672e-14, 2.5263e-11, 2.2510e-09]])}" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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.12.6" } }, "nbformat": 4, "nbformat_minor": 2 }