{ "cells": [ { "cell_type": "raw", "metadata": {}, "source": [ "---\n", "description: Gradio app.py\n", "output-file: app.html\n", "title: app\n", "\n", "---\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "---\n", "\n", "[source](https://gitlab.com/animalequality/lv-recipe-chatbot/blob/main/lv_recipe_chatbot/app.py#L32){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### ConversationBot\n", "\n", "> ConversationBot (verbose=True)\n", "\n", "Initialize self. See help(type(self)) for accurate signature." ], "text/plain": [ "---\n", "\n", "[source](https://gitlab.com/animalequality/lv-recipe-chatbot/blob/main/lv_recipe_chatbot/app.py#L32){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### ConversationBot\n", "\n", "> ConversationBot (verbose=True)\n", "\n", "Initialize self. See help(type(self)) for accurate signature." ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#| echo: false\n", "#| output: asis\n", "show_doc(ConversationBot)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "data": { "text/plain": [ "Path('/home/evylz/AnimalEquality/lv-recipe-chatbot/assets/images/vegan_ingredients')" ] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "os.listdir(SAMPLE_IMG_DIR)\n", "SAMPLE_IMG_DIR" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [], "source": [ "from dotenv import load_dotenv" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#: eval: false\n", "load_dotenv()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 6.19 s, sys: 1.47 s, total: 7.66 s\n", "Wall time: 4.68 s\n" ] } ], "source": [ "#| eval: false" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "I uploaded an image that may contain vegan ingredients.\n", "The description of the image is: `a refrigerator with food inside`.\n", "The extracted ingredients are:\n", "```\n", "cabbage lettuce onion\n", "apples\n", "rice\n", "plant-based milk\n", "```\n", "\n", "CPU times: user 56.7 s, sys: 63.6 ms, total: 56.8 s\n", "Wall time: 5.95 s\n" ] } ], "source": [ "#| eval: false" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "---\n", "\n", "[source](https://gitlab.com/animalequality/lv-recipe-chatbot/blob/main/lv_recipe_chatbot/app.py#L116){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### create_demo\n", "\n", "> create_demo (bot=)" ], "text/plain": [ "---\n", "\n", "[source](https://gitlab.com/animalequality/lv-recipe-chatbot/blob/main/lv_recipe_chatbot/app.py#L116){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### create_demo\n", "\n", "> create_demo (bot=)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#| echo: false\n", "#| output: asis\n", "show_doc(create_demo)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Closing server running on port: 7860\n", "Running on local URL: http://127.0.0.1:7860\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#| eval: false\n", "if \"demo\" in globals():\n", " demo.close()\n", "demo = create_demo(bot)\n", "demo.launch()" ] } ], "metadata": { "kernelspec": { "display_name": "python3", "language": "python", "name": "python3" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }