gradio: unable to run on kaggle

Describe the bug

I have installed gradio using “!pip3 install gradio==3.45.0 typing_extensions==4.5.0” command.It works fine on google colab, but it doesn’t work on kaggle.It loads the ui correctly, then once I try to use the url or try to interact through notebook cell output, the system crashes and restarts.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

  def predict(message, history):
      # output = message # debug mode
  
      output = str(llm_ans(message)).replace("\n", "<br/>")
      return output
  
  demo = gr.ChatInterface(
      predict,
      title = f'Adolescent Chatbot(LLama-2-7b)'
  )
  
  demo.queue()
  demo.launch()

Screenshot

Screenshot 2023-10-29 at 11 57 55 AM

Logs

No response

System Info

The latest version of gradio doesn't work on colab/kaggle, it shows error with typing_extensions library.

Severity

Blocking usage of gradio

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 20

Most upvoted comments

Hello, Gradio is working all right on collab. but it’s flashing connection error on Kaggle notebook. and runtime also get disconnected.

I believe that kaggle limited gradio usage or any other web UI kit

Kaggle works with ngrok: you can start gradio locally end expose the endpoint via ngrok. Still, it would be great to find a way to make gradio work with --share=True as well.

is this script is right?

!git clone https://github.com/vinthony/SadTalker.git

%cd SadTalker

!pip install -r requirements.txt

!bash scripts/download_models.sh

!bash webui.sh

- Option 2: Running with Ngrok -

Ngrok_token = “2jrBknQZ6W8uJ8OPGO1RXp5ws7V_6Psd5ZCbokzehpK93U5KS” #@param {type:“string”}

Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = “” # optional, leave empty if you don’t have a domain

--------------------------------

!pip install pyngrok

from pyngrok import ngrok, conf import fileinput import sys

if Ngrok_token!=“”: ngrok.kill() srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token), bind_tls=True, domain=Ngrok_domain).public_url print(srv) get_ipython().system(“!python app_sadtalker.py”)

or make it from print(srv) get_ipython().system(“!python app_sadtalker.py”)

to !python app_sadtalker.py

this" !python app_sadtalker.py" option dosen’t work and didn’t lead me to use the webui through Ngrok)

https://www.kaggle.com/code/hebatullahhesham2/notebookca8ba0484c

by the way u should replace with below script

print(srv)
  get_ipython().system("python app_sadtalker.py")
else:

do not use !python xxxxxx just python. why did you like to use kaggle? is about free gpu runtime? kaggle was so suck for me they ban while we use something like swap face app eg.facefuion now I use webui at Huggingface space. they banned my two accounts and then I didn’t use anymore.othewise kaggle do not support Huggingface repo.

https://huggingface.co/victorisgeek

Simply run app.py with replace your auth ngrok token.


# - Option 2: Running with Ngrok - #

Ngrok_token = "Your_Ngrok_Tonken" #@param {type:"string"}
# Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = "" # optional, leave empty if you don't have a domain

# -------------------------------- #

!pip install pyngrok

from pyngrok import ngrok, conf
import fileinput
import sys

if Ngrok_token!="":
  ngrok.kill()
  srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),
                    bind_tls=True, domain=Ngrok_domain).public_url
  print(srv)
  get_ipython().system("python app.py")
else:
  print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token 

is it will be like this?:

!git clone https://github.com/OpenTalker/SadTalker.git

%cd SadTalker

!pip install -r requirements.txt

!bash scripts/download_models.sh

!bash webui.sh

- Option 2: Running with Ngrok -

Ngrok_token = “2jrBknQZ6W8uJ8OPGO1RXp5ws7V_6Psd5ZCbokzehpK93U5KS” #@param {type:“string”}

Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = “” # optional, leave empty if you don’t have a domain

--------------------------------

!pip install pyngrok

from pyngrok import ngrok, conf import fileinput import sys

if Ngrok_token!=“”: ngrok.kill() srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token), bind_tls=True, domain=Ngrok_domain).public_url print(srv) get_ipython().system(“python app.py”) else: print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token

Replace these two

get_ipython().system("python app.py") else:

to

python app_sadtalker.py

Replace app.py with right py (app_sadtalker.py) or rename python app_sadtalker.py to app.py

THEN you will smile

Simply run app.py with replace your auth ngrok token.


# - Option 2: Running with Ngrok - #

Ngrok_token = "Your_Ngrok_Tonken" #@param {type:"string"}
# Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = "" # optional, leave empty if you don't have a domain

# -------------------------------- #

!pip install pyngrok

from pyngrok import ngrok, conf
import fileinput
import sys

if Ngrok_token!="":
  ngrok.kill()
  srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),
                    bind_tls=True, domain=Ngrok_domain).public_url
  print(srv)
  get_ipython().system("python app.py")
else:
  print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token 

is it will be like this?:

!git clone https://github.com/OpenTalker/SadTalker.git

%cd SadTalker

!pip install -r requirements.txt

!bash scripts/download_models.sh

!bash webui.sh

- Option 2: Running with Ngrok -

Ngrok_token = “2jrBknQZ6W8uJ8OPGO1RXp5ws7V_6Psd5ZCbokzehpK93U5KS” #@param {type:“string”}

Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = “” # optional, leave empty if you don’t have a domain

--------------------------------

!pip install pyngrok

from pyngrok import ngrok, conf import fileinput import sys

if Ngrok_token!=“”: ngrok.kill() srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token), bind_tls=True, domain=Ngrok_domain).public_url print(srv) get_ipython().system(“python app.py”) else: print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token

Simply run app.py with replace your auth ngrok token.


# - Option 2: Running with Ngrok - #

Ngrok_token = "Your_Ngrok_Tonken" #@param {type:"string"}
# Put your ngrok token here (obtainable from https://ngrok.com)

Ngrok_domain = "" # optional, leave empty if you don't have a domain

# -------------------------------- #

!pip install pyngrok

from pyngrok import ngrok, conf
import fileinput
import sys

if Ngrok_token!="":
  ngrok.kill()
  srv=ngrok.connect(7860 , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),
                    bind_tls=True, domain=Ngrok_domain).public_url
  print(srv)
  get_ipython().system("python app.py")
else:
  print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token 

Kaggle works with ngrok: you can start gradio locally end expose the endpoint via ngrok. Still, it would be great to find a way to make gradio work with --share=True as well.

Please How to use SadTalker gradio WebUI on kaggle notebook by connecting it with Ngrok? Is Kaggle have banned using webui directly?

Please, I need help. Here is the code I run on cells for using SadTalker on Kaggle that doesn’t lead me to use the WebUI:

  1. !git clone https://github.com/vinthony/SadTalker.git
  2. %cd SadTalker
  3. !pip install -r requirements.txt
  4. !bash scripts/download_models.sh
  5. !bash webui.sh

It always appears to be the same issue again and again, even if I try to install, upgrade, or downgrade a specific Gradio version.

File “app_sadtalker.py”, line 35, in sadtalker_demo with gr.Row().style(equal_height=False): AttributeError: ‘Row’ object has no attribute ‘style’

I have solved this issue on my local device by installing the required Python version, which was 3.10.6, uninstalling other versions on my device, and making sure to delete the remaining corrupted files from the older version so it can be fixed if there is a conflict with the other version.

I really appreciate your help because I have asked ChatGPT, and it was absolutely dumb.

Hello, Gradio is working all right on collab. but it’s flashing connection error on Kaggle notebook. and runtime also get disconnected.

Same here, disconnects and stop session

I have faced with the same error.