Quando fui importar a biblioteca gradio, recebi esta mensagem de erro durante a execução da célula:
Error importing huggingface_hub._login: cannot import name 'DeviceCodeError' from 'huggingface_hub.errors' (/usr/local/lib/python3.12/dist-packages/huggingface_hub/errors.py)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_7749/3519786720.py in <cell line: 0>()
5 # componente 4: salvar as respostas no formato pdf
6
----> 7 import gradio as gr
8
9 #cria contexto
7 frames
/usr/local/lib/python3.12/dist-packages/huggingface_hub/_login.py in <module>
24
25 from . import constants
---> 26 from .errors import DeviceCodeError
27 from .utils import (
28 ANSI,
ImportError: cannot import name 'DeviceCodeError' from 'huggingface_hub.errors' (/usr/local/lib/python3.12/dist-packages/huggingface_hub/errors.py)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Verificando com o Claude, ao invés de usar só o !pip install gradio eu usei !pip install -U huggingface_hub gradio.
Isso se deve a dependências que possam existir entre as duas bibliotecas. Feito isso, reiniciei a sessão e executei tudo novamente e consegui rodar a célula importando o gradio e gerando a página web.
