{ "cells": [ { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [], "source": [ "from transformers import pipeline\n", "import pandas as pd\n", "import torch\n", "\n", "\n", "table = pd.read_excel(\"MS_IS_50_modules_cleaned.xlsx\")\n", "table = table.astype(str)\n", "\n", "tqa = pipeline(task=\"table-question-answering\", model=\"google/tapas-large-finetuned-wtq\")" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Programming with neural nets']\n" ] } ], "source": [ "question = \"Which modules titles are about programming?\"\n", "c = tqa(table, query=question)['cells']\n", "\n", "print(c)" ] } ], "metadata": { "kernelspec": { "display_name": "py38", "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.8.16" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }