{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "view-in-github" }, "source": [ "" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "x6dFfL0QUr8P", "outputId": "58f3b497-f4e8-46bc-a40c-b564f6e14010" }, "outputs": [], "source": [ "#@title Check out source repo if not automatically available\n", "# !git clone https://github.com/GuardianUI/ui-refexp\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RQdzURjDWYco", "outputId": "2628c536-780e-4544-8f37-33a7e79ee367" }, "outputs": [], "source": [ "# Go to hf space dir if not already there\n", "# !cd ui-refexp/hf-space && \n", "\n", "!pip3 install -r requirements.txt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# from PIL import Image, ImageDraw\n", "# from transformers import DonutProcessor, VisionEncoderDecoderModel\n", "\n", "# pretrained_repo_name = 'ivelin/donut-refexp-click'\n", "# pretrained_revision = 'main'\n", "# # revision can be git commit hash, branch or tag\n", "# # use 'main' for latest revision\n", "# print(f\"Loading model checkpoint: {pretrained_repo_name}\")\n", "\n", "# proc = DonutProcessor.from_pretrained(\n", "# pretrained_repo_name, revision=pretrained_revision, use_auth_token=\"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\")\n", "# proc.image_processor.do_align_long_axis = False\n", "# proc.image_processor.do_resize = False\n", "# proc.image_processor.do_thumbnail = False\n", "# proc.image_processor.do_pad = False\n", "# proc.image_processor.do_rescale = False\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/gitpod/.pyenv/versions/3.8.16/lib/python3.8/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Loading model checkpoint: ivelin/donut-refexp-click\n", "processor image size: {'height': 1280, 'width': 960}\n", "Running on local URL: http://127.0.0.1:7860\n", "Running on public URL: https://f2beb057-2b06-4a52.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "