How to debug Spaces on hf.co
I have a model/app deployment that works perfectly on my local machine and errors out after 1-2 seconds upon pressing “submit” on the hosted Gradio app. Where can I check a log of what is going on? I have no clue… and the documentation for spaces seems incomplete, at least from what I found.
2021-12-29T06:48:49Z
Hello@pszemrajCan you send me the link to your Space?If you’re using it with gradio try settingdebug = Truewhen launching (one thing I can think of).
2021-12-29T09:15:57Z
As@mervementioned, settingdebug=Trueis a good idea. On top of that, once you see the fail message, you can click in “Running” or “Build error” next to the like count, and that will actually show you the logs.  FYI we have an internal PR to make this a clear button.Eg, for your space, I see the following errorDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 84, in __loadroot = nltk.data.find(f"{self.subdir}/{zip_name}")File “/home/user/.local/lib/python3.8/site-packages/nltk/data.py”, line 583, in findraise LookupError(resource_not_found)LookupError:Resource e[93mstopwordse[0m not found.Please use the NLTK Downloader to obtain the resource:e[31m>>> import nltknltk.download(‘stopwords’)e[0mFor more information see:NLTK :: Installing NLTK DataAttempted to load e[93mcorpora/stopwords.zip/stopwords/e[0mSearched in:- ‘/home/user/nltk_data’- ‘/usr/local/nltk_data’- ‘/usr/local/share/nltk_data’- ‘/usr/local/lib/nltk_data’- ‘/usr/share/nltk_data’- ‘/usr/local/share/nltk_data’- ‘/usr/lib/nltk_data’- ‘/usr/local/lib/nltk_data’During handling of the above exception, another exception occurred:Traceback (most recent call last):File “/home/user/.local/lib/python3.8/site-packages/gradio/networking.py”, line 196, in predictprediction, durations = app.interface.process(raw_input)File “/home/user/.local/lib/python3.8/site-packages/gradio/interface.py”, line 373, in processpredictions, durations = self.run_prediction(File “/home/user/.local/lib/python3.8/site-packages/gradio/interface.py”, line 339, in run_predictionprediction = predict_fn(*processed_input)File “app.py”, line 86, in chatresponse = ask_gpt(message)File “app.py”, line 57, in ask_gptprompt = clean(message)  # clean user inputFile “/home/user/.local/lib/python3.8/site-packages/cleantext/cleantext.py”, line 8, in cleanstop_words = nltk.corpus.stopwords.words(stp_lang)File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 121, ingetattrself.__load()File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 86, in __loadraise eFile “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 81, in __loadroot = nltk.data.find(f"{self.subdir}/{self.__name}")File “/home/user/.local/lib/python3.8/site-packages/nltk/data.py”, line 583, in findraise LookupError(resource_not_found)LookupError:Resource e[93mstopwordse[0m not found.Please use the NLTK Downloader to obtain the resource:e[31m>>> import nltknltk.download(‘stopwords’)e[0mFor more information see:NLTK :: Installing NLTK DataAttempted to load e[93mcorpora/stopwordse[0mSearched in:- ‘/home/user/nltk_data’- ‘/usr/local/nltk_data’- ‘/usr/local/share/nltk_data’- ‘/usr/local/lib/nltk_data’- ‘/usr/share/nltk_data’- ‘/usr/local/share/nltk_data’- ‘/usr/lib/nltk_data’- ‘/usr/local/lib/nltk_data’
2021-12-29T11:26:07Z
Ah I completely forgot this!You might have NLTK packages that are on your local but not Spaces, that’s why it works on local imo.
2022-02-14T19:01:03Z
Thanks so much, and sorry for my super late response. Adding some details for you / others that may come across this post later:the space in question wasthis onenltk packages were indeed the culprit - after installing, it worked fine.what I was ultimately looking for, though, has since been handled/upgraded. It is now much more obvious how to see the logs (see below image), which I struggled to find when you had to click on the “error” icon to see logs.image2181×173 29.2 KB