{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "EpuzgeBWEYWR", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 29790, "status": "ok", "timestamp": 1729514059235, "user": { "displayName": "Ayush kumar", "userId": "09471472999674147959" }, "user_tz": -330 }, "id": "EpuzgeBWEYWR", "outputId": "3f0077f2-6be0-498e-c8ea-ea605099759a" }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 2, "id": "522d1bb0-d1df-4811-bc4e-1062e1ee4515", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 609 }, "executionInfo": { "elapsed": 29742, "status": "ok", "timestamp": 1729514088953, "user": { "displayName": "Ayush kumar", "userId": "09471472999674147959" }, "user_tz": -330 }, "id": "522d1bb0-d1df-4811-bc4e-1062e1ee4515", "outputId": "046cc978-0a86-40fa-a117-56c248b60032" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* Running on local URL: http://127.0.0.1:7869\n", "* Running on public URL: https://c4db01568dfdb26c7a.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "Switch between BERT, BART, and DistilBERT models and ask questions based on the context.
\")\n", "\n", " context_state = gr.State()\n", " model_choice_state = gr.State(value=\"BERT\") # Default model is BERT\n", "\n", " with gr.Row():\n", " with gr.Column(scale=11): # Left panel for chatbot and question input (45%)\n", " chatbot = gr.Chatbot(label=\"Chatbot\")\n", " question_input = gr.Textbox(label=\"Ask a Question\", placeholder=\"Enter your question here...\", lines=1)\n", " submit_btn = gr.Button(\"Submit Question\")\n", "\n", " with gr.Column(scale=9): # Right panel for setting context and instructions (55%)\n", " context_input = gr.Textbox(label=\"Set Context\", placeholder=\"Enter the context here...\", lines=4)\n", " set_context_btn = gr.Button(\"Set Context\")\n", " clear_context_btn = gr.Button(\"Clear Context\")\n", "\n", " # Model selection buttons\n", " model_selection = gr.Radio(choices=[\"BERT\", \"BART\", \"DistilBERT\"], label=\"Select Model\", value=\"BERT\")\n", " status_message = gr.Markdown(\"\")\n", "\n", " gr.Markdown(\"Instructions: