{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "2f36b8ed6b5f47c9beffb251660ab817": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_dd79591e26d54d749f84339205484e50", "IPY_MODEL_6b4a398fb55d4b509188d16cd66615ed", "IPY_MODEL_419f9b313a5e4fb5b5a5b1c8db30cd27" ], "layout": "IPY_MODEL_39f7db24cde842828d2b2f10b947c9b3" } }, "dd79591e26d54d749f84339205484e50": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_2d0f034676124ae68c8304249b50105a", "placeholder": "​", "style": "IPY_MODEL_5e30295db2ed4bd1803070be6e39020a", "value": "Loading checkpoint shards: 100%" } }, "6b4a398fb55d4b509188d16cd66615ed": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ab753d3138414937b882712412a14550", "max": 3, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7c265c9ce1bf46638dc42beb01b4bb31", "value": 3 } }, "419f9b313a5e4fb5b5a5b1c8db30cd27": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_e4c9fe5abf9f47498a249ba80e1b47fb", "placeholder": "​", "style": "IPY_MODEL_cc23e8d656e844309e35dfba411cd75c", "value": " 3/3 [01:08<00:00, 22.20s/it]" } }, "39f7db24cde842828d2b2f10b947c9b3": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2d0f034676124ae68c8304249b50105a": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5e30295db2ed4bd1803070be6e39020a": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "ab753d3138414937b882712412a14550": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "7c265c9ce1bf46638dc42beb01b4bb31": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "e4c9fe5abf9f47498a249ba80e1b47fb": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "cc23e8d656e844309e35dfba411cd75c": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "9nImld6CECvz", "outputId": "533ce939-be31-4f83-d6d2-09db03a02e25" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n" ] } ], "source": [ "!pip install -q -U transformers==4.37.2\n", "!pip install -q bitsandbytes==0.41.3 accelerate==0.25.0\n", "!pip install -q git+https://github.com/openai/whisper.git\n", "!pip install -q gradio\n", "!pip install -q gTTS" ] }, { "cell_type": "code", "source": [ "import torch\n", "from transformers import BitsAndBytesConfig, pipeline" ], "metadata": { "id": "c5xSk8MzFUPj" }, "execution_count": 2, "outputs": [] }, { "cell_type": "code", "source": [ "quantization_config = BitsAndBytesConfig(\n", " load_in_4bit=True,\n", " bnb_4bit_compute_dtype=torch.float16\n", "\n", ")" ], "metadata": { "id": "97Hub2vjHdF1" }, "execution_count": 3, "outputs": [] }, { "cell_type": "code", "source": [ "model_id = 'llava-hf/llava-1.5-7b-hf'" ], "metadata": { "id": "ZeZ3wd8zHvfd" }, "execution_count": 4, "outputs": [] }, { "cell_type": "code", "source": [ "pipe = pipeline(\"image-to-text\",\n", " model=model_id,\n", " model_kwargs={\"quantization_config\": quantization_config})" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 190, "referenced_widgets": [ "2f36b8ed6b5f47c9beffb251660ab817", "dd79591e26d54d749f84339205484e50", "6b4a398fb55d4b509188d16cd66615ed", "419f9b313a5e4fb5b5a5b1c8db30cd27", "39f7db24cde842828d2b2f10b947c9b3", "2d0f034676124ae68c8304249b50105a", "5e30295db2ed4bd1803070be6e39020a", "ab753d3138414937b882712412a14550", "7c265c9ce1bf46638dc42beb01b4bb31", "e4c9fe5abf9f47498a249ba80e1b47fb", "cc23e8d656e844309e35dfba411cd75c" ] }, "id": "DUIG1iTdH4Bo", "outputId": "b671f177-6ff7-4b89-a560-e8c75a096c12" }, "execution_count": 5, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning: \n", "The secret `HF_TOKEN` does not exist in your Colab secrets.\n", "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n", "You will be able to reuse this secret in all of your notebooks.\n", "Please note that authentication is recommended but still optional to access public models or datasets.\n", " warnings.warn(\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "Loading checkpoint shards: 0%| | 0/3 [00:00\\n\" + prompt_instructions + \"\\nAssistant:\"\n", " outputs = pipe(image,prompt=prompt, generate_kwargs={\"max_new_tokens\": 250})\n", "\n", " if outputs is not None and len(outputs[0][\"generated_text\"])>0:\n", " match = re.search(r'Assistant:\\s*(.*)',outputs[0][\"generated_text\"])\n", " if match:\n", " reply = match.group(1)\n", " else:\n", " reply = \"no response\"\n", " else:\n", " reply = \"no response generated\"\n", " return reply" ], "metadata": { "id": "-XBVEZhvjw-y" }, "execution_count": 13, "outputs": [] }, { "cell_type": "code", "source": [ "def transcribe(audio):\n", "\n", " # Check if the audio input is None or empty\n", " if audio is None or audio == '':\n", " return ('','',None) # Return empty strings and None audio file\n", "\n", " # language = 'en'\n", "\n", " audio = whisper.load_audio(audio)\n", " audio = whisper.pad_or_trim(audio)\n", "\n", " mel = whisper.log_mel_spectrogram(audio).to(model.device)\n", "\n", " _, probs = model.detect_language(mel)\n", "\n", " options = whisper.DecodingOptions()\n", " result = whisper.decode(model, mel, options)\n", " result_text = result.text\n", "\n", " return result_text" ], "metadata": { "id": "-lo6sMtOmInA" }, "execution_count": 14, "outputs": [] }, { "cell_type": "code", "source": [ "\n", "def text_to_speech(text, file_path):\n", " language = 'en'\n", "\n", " audioobj = gTTS(text = text,\n", " lang = language,\n", " slow = False)\n", "\n", " audioobj.save(file_path)\n", "\n", " return file_path" ], "metadata": { "id": "VAK4GnHqmMwW" }, "execution_count": 15, "outputs": [] }, { "cell_type": "code", "source": [ "!ffmpeg -f lavfi -i anullsrc=r=44100:cl=mono -t 10 -q:a 9 -acodec libmp3lame Temp.mp3" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "nC7EtQ1NmPwr", "outputId": "95844e73-f625-45c1-dd4b-a8ffab0b61d9" }, "execution_count": 17, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers\n", " built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)\n", " configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared\n", " libavutil 56. 70.100 / 56. 70.100\n", " libavcodec 58.134.100 / 58.134.100\n", " libavformat 58. 76.100 / 58. 76.100\n", " libavdevice 58. 13.100 / 58. 13.100\n", " libavfilter 7.110.100 / 7.110.100\n", " libswscale 5. 9.100 / 5. 9.100\n", " libswresample 3. 9.100 / 3. 9.100\n", " libpostproc 55. 9.100 / 55. 9.100\n", "Input #0, lavfi, from 'anullsrc=r=44100:cl=mono':\n", " Duration: N/A, start: 0.000000, bitrate: 352 kb/s\n", " Stream #0:0: Audio: pcm_u8, 44100 Hz, mono, u8, 352 kb/s\n", "Stream mapping:\n", " Stream #0:0 -> #0:0 (pcm_u8 (native) -> mp3 (libmp3lame))\n", "Press [q] to stop, [?] for help\n", "Output #0, mp3, to 'Temp.mp3':\n", " Metadata:\n", " TSSE : Lavf58.76.100\n", " Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p\n", " Metadata:\n", " encoder : Lavc58.134.100 libmp3lame\n", "size= 0kB time=00:00:00.00 bitrate=N/A speed=N/A \rsize= 39kB time=00:00:09.97 bitrate= 32.2kbits/s speed= 107x \n", "video:0kB audio:39kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.568409%\n" ] } ] }, { "cell_type": "code", "source": [ "import gradio as gr\n", "import base64\n", "import os\n", "\n", "# A function to handle audio and image inputs\n", "def process_inputs(audio_path, image_path):\n", " # Process the audio file (assuming this is handled by a function called 'transcribe')\n", " speech_to_text_output = transcribe(audio_path)\n", "\n", " # Handle the image input\n", " if image_path:\n", " chatgpt_output = img2txt(speech_to_text_output, image_path)\n", " else:\n", " chatgpt_output = \"No image provided.\"\n", "\n", " # Assuming 'transcribe' also returns the path to a processed audio file\n", " processed_audio_path = text_to_speech(chatgpt_output, \"Temp.mp3\") # Replace with actual path if different\n", "\n", " return speech_to_text_output, chatgpt_output, processed_audio_path\n", "\n", "# Create the interface\n", "iface = gr.Interface(\n", " fn=process_inputs,\n", " inputs=[\n", " gr.Audio(sources=[\"microphone\"], type=\"filepath\"),\n", " gr.Image(type=\"filepath\")\n", " ],\n", " outputs=[\n", " gr.Textbox(label=\"Speech to Text\"),\n", " gr.Textbox(label=\"ChatGPT Output\"),\n", " gr.Audio(\"Temp.mp3\")\n", " ],\n", " title=\"Learn OpenAI Whisper: Image processing with Whisper and Llava\",\n", " description=\"Upload an image and interact via voice input and audio response.\"\n", ")\n", "\n", "# Launch the interface\n", "iface.launch(debug=True)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "wdGtBi3QmV4L", "outputId": "267c123e-2f0f-4bed-be0b-3a9ddb83490d" }, "execution_count": null, "outputs": [ { "metadata": { "tags": null }, "name": "stdout", "output_type": "stream", "text": [ "Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", "\n", "Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch().\n", "Running on public URL: https://6d13e2910598c25aef.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "metadata": { "tags": null }, "name": "stderr", "output_type": "stream", "text": [ "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n", "ERROR: Exception in ASGI application\n", "Traceback (most recent call last):\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py\", line 407, in run_asgi\n", " result = await app( # type: ignore[func-returns-value]\n", " File \"/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py\", line 69, in __call__\n", " return await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/applications.py\", line 1054, in __call__\n", " await super().__call__(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/applications.py\", line 123, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 186, in __call__\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py\", line 164, in __call__\n", " await self.app(scope, receive, _send)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 713, in __call__\n", " await self.simple_response(scope, receive, send, request_headers=headers)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 729, in simple_response\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py\", line 65, in __call__\n", " await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 756, in __call__\n", " await self.middleware_stack(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 776, in app\n", " await route.handle(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 297, in handle\n", " await self.app(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 77, in app\n", " await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 64, in wrapped_app\n", " raise exc\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n", " await app(scope, receive, sender)\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/routing.py\", line 72, in app\n", " response = await func(request)\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 278, in app\n", " raw_response = await run_endpoint_function(\n", " File \"/usr/local/lib/python3.10/dist-packages/fastapi/routing.py\", line 191, in run_endpoint_function\n", " return await dependant.call(**values)\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/routes.py\", line 1058, in upload_file\n", " form = await multipart_parser.parse()\n", " File \"/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py\", line 597, in parse\n", " async for chunk in self.stream:\n", " File \"/usr/local/lib/python3.10/dist-packages/starlette/requests.py\", line 238, in stream\n", " raise ClientDisconnect()\n", "starlette.requests.ClientDisconnect\n" ] } ] } ] }