gradio icon indicating copy to clipboard operation
gradio copied to clipboard

unable to run on kaggle

Open ml-maddi opened this issue 1 year ago • 19 comments

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? 🔎

  • [X] 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

ml-maddi avatar Oct 29 '23 06:10 ml-maddi

Running into the same issue in any jupyter notebook. The hello world example shared on the quickstart does not work https://www.gradio.app/guides/quickstart https://colab.research.google.com/drive/18ODkJvyxHutTN0P5APWyGFO_xwNcgHDZ?usp=sharing#scrollTo=qtlFLbke2Sob

module 'gradio' has no attribute 'inputs'

psylabs avatar Nov 20 '23 21:11 psylabs

Can't repro the problem on a general jupyter notebook @psylabs. The module 'gradio' has no attribute 'inputs' error means the demo is using a deprecated api like gr.inputs.Textbox().

Take a look at the migration guide: https://www.gradio.app/changelog (scroll down to the 4.0 changelog).

freddyaboulton avatar Nov 21 '23 17:11 freddyaboulton

Thanks! You are right, even though pip install was throwing warnings, it still worked. I'm running the example commands in this nb.

!pip install -q gradio does says tensorflow-probability 0.22.0 requires typing-extensions<4.6.0, but you have typing-extensions 4.8.0 which is incompatible.

image

But if I just ignore that warning the rest of the nb still worked. While this is true in colab, in a databricks notebooks it's complaining more violently. image image

psylabs avatar Nov 21 '23 18:11 psylabs

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

meet5398 avatar Feb 16 '24 05:02 meet5398

I have faced with the same error.

AlicanAKCA avatar Feb 17 '24 13:02 AlicanAKCA

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

Alfa-beto avatar Feb 19 '24 18:02 Alfa-beto

Also getting the same error and the session disconnected Any workaround?

joaopedrosdmm avatar Mar 02 '24 23:03 joaopedrosdmm

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

joaopedrosdmm avatar Mar 04 '24 18:03 joaopedrosdmm

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.

mcanti avatar May 22 '24 11:05 mcanti

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.

HebatullahHesham avatar Jul 12 '24 04:07 HebatullahHesham

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?

HebatullahHesham avatar Jul 12 '24 04:07 HebatullahHesham

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 

victorgeel avatar Aug 08 '24 06:08 victorgeel

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

HebatullahHesham avatar Aug 09 '24 19:08 HebatullahHesham

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 

i think the print(srv) get_ipython().system("python app.py") there is no file in sadtalker such as "python app.py" to run the webui what is the correct command to complete the process to run sadtalker gradio webui through Ngrok?

HebatullahHesham avatar Aug 09 '24 20:08 HebatullahHesham

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

victorgeel avatar Aug 10 '24 03:08 victorgeel

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

%cd SadTalker

!pip install -r requirements.txt

!bash scripts/download_models.sh

!bash webui.sh

what about these steps:

https://github.com/gradio-app/gradio/issues/6132#issuecomment-2278965586

HebatullahHesham avatar Aug 11 '24 02:08 HebatullahHesham

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

HebatullahHesham avatar Aug 11 '24 02:08 HebatullahHesham

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

victorgeel avatar Aug 11 '24 14:08 victorgeel

I used Hugging face and duplicate vinthony/SadTalker space on Hugging face but the RunTime is max 5 hours on the free plan, I cloned this space on my device and moved it to my private space and I faced the same problem, the project is up to 7 GB

HebatullahHesham avatar Aug 11 '24 19:08 HebatullahHesham