Spaces:
Runtime error
Able to run locally?
First thanks for this amazing project. I wonder whether I can clone the code and run app.py locally? It seems that not like the github repo, the files here are incomplete? Thanks.
Thank you! This is very helpful.
Hi
@ChenWu98
, sorry that I encountered another issue when I ran the code with streamlit. Do you have any thoughts what might cause the problem?
The app seems to start with generating many samples, occasionally throwing exceptions. It ignores the first few exceptions and proceeds, until crashes totally.
The webUI shows nothing but an exception. Thank you very much.
streamlit run app.py
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://172.20.1.2:8501
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 2939.89it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 1644.50it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 102.64it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 2388.64it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 917.43it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 239.59it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 123.96it/s]
Fetching 16 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโ| 16/16 [00:00<00:00, 380.91it/s]
/home/jefflee/.local/lib/python3.8/site-packages/torch/nn/modules/module.py:1383: UserWarning: positional arguments and argument "destination" are deprecated. nn.Module.state_dict will not accept them in the future. Refer to https://pytorch.org/docs/master/generated/torch.nn.Module.html#torch.nn.Module.state_dict for details.
warnings.warn(
/home/jefflee/.local/lib/python3.8/site-packages/gradio/deprecation.py:40: UserWarning: `height` is deprecated in `Interface()`, please use it within `launch()` instead.
warnings.warn(value)
Using cache from '/home/jefflee/cycledis/gradio_cached_examples/201' directory. If method or examples have changed since last caching, delete this folder to clear cache.
Caching examples at: '/home/jefflee/cycledis/gradio_cached_examples/202/log.csv'
2022-11-18 22:51:07.514 Uncaught app exception
Traceback (most recent call last):
File "/home/jefflee/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 563, in _run_script
exec(code, module.__dict__)
File "/home/jefflee/cycledis/app.py", line 410, in <module>
gr.Markdown('''
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/blocks.py", line 1063, in __exit__
self.app = routes.App.create_app(self)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 99, in create_app
app = App(default_response_class=ORJSONResponse)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 75, in __init__
self.lock = asyncio.Lock()
File "/usr/lib/python3.8/asyncio/locks.py", line 164, in __init__
self._loop = events.get_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'.
Caching examples at: '/home/jefflee/cycledis/gradio_cached_examples/203/log.csv'
Using cache from '/home/jefflee/cycledis/gradio_cached_examples/200' directory. If method or examples have changed since last caching, delete this folder to clear cache.
2022-11-18 22:51:07.634 Uncaught app exception
Traceback (most recent call last):
File "/home/jefflee/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 563, in _run_script
exec(code, module.__dict__)
File "/home/jefflee/cycledis/app.py", line 410, in <module>
gr.Markdown('''
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/blocks.py", line 1063, in __exit__
self.app = routes.App.create_app(self)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 99, in create_app
app = App(default_response_class=ORJSONResponse)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 75, in __init__
self.lock = asyncio.Lock()
File "/usr/lib/python3.8/asyncio/locks.py", line 164, in __init__
self._loop = events.get_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'.
8%|โโโโ | 6/80 [00:01<00:19, 3.89it/s]/home/jefflee/.local/lib/python3.8/site-packages/gradio/deprecation.py:40: UserWarning: `height` is deprecated in `Interface()`, please use it within `launch()` instead.
warnings.warn(value)
Caching examples at: '/home/jefflee/cycledis/gradio_cached_examples/254/log.csv'
Caching examples at: '/home/jefflee/cycledis/gradio_cached_examples/399/log.csv'
Caching examples at: '/home/jefflee/cycledis/gradio_cached_examples/400/log.csv']
Using cache from '/home/jefflee/cycledis/gradio_cached_examples/401' directory. If method or examples have changed since last caching, delete this folder to clear cache.
2022-11-18 22:51:10.211 Uncaught app exception
Traceback (most recent call last):
File "/home/jefflee/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 563, in _run_script
exec(code, module.__dict__)
File "/home/jefflee/cycledis/app.py", line 410, in <module>
gr.Markdown('''
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/blocks.py", line 1063, in __exit__
self.app = routes.App.create_app(self)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 99, in create_app
app = App(default_response_class=ORJSONResponse)
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/routes.py", line 75, in __init__
self.lock = asyncio.Lock()
File "/usr/lib/python3.8/asyncio/locks.py", line 164, in __init__
self._loop = events.get_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'.
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 80/80 [00:46<00:00, 1.72it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 80/80 [00:46<00:00, 1.71it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 80/80 [00:48<00:00, 1.65it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 80/80 [00:48<00:00, 1.64it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 80/80 [00:48<00:00, 1.63it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 90/90 [00:56<00:00, 1.60it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 90/90 [00:56<00:00, 1.60it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 90/90 [00:56<00:00, 1.60it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 90/90 [00:56<00:00, 1.59it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 90/90 [00:56<00:00, 1.59it/s]
88%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 75/85 [00:45<00:06, 1.62it/s]
87%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 74/85 [00:44<00:06, 1.61it/s]
76%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 65/85 [00:40<00:12, 1.62it/s]
76%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 65/85 [00:40<00:12, 1.61it/s]
74%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 63/85 [00:39<00:13, 1.58it/s]
In the browser, the error is:
AttributeError: 'NoneType' object has no attribute 'blocks'
Traceback:
File "/home/jefflee/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 563, in _run_script
exec(code, module.__dict__)
File "/home/jefflee/cycledis/app.py", line 410, in <module>
gr.Markdown('''
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/blocks.py", line 1057, in __exit__
self.attach_load_events()
File "/home/jefflee/.local/lib/python3.8/site-packages/gradio/blocks.py", line 1565, in attach_load_events
for component in Context.root_block.blocks.values():
Hi, it starts with generating many examples because I set cache_examples=True
in app.py. Can you try turning this flag off? It works on my machine, but let me know if you encounter any errors.
Thank you
@ChenWu98
! Finally it runs.
A few things I changed (in case someone needs it):
cache_examples=False
(as you suggested)- Create
.streamlit/secrets.toml
, which containsUSER_TOKEN = "blahblah (one's huggingface token)"
- Shouldn't run with
streamlit run app.py
. Instead run it withpython3 app.py
. - The newest streamlit==1.15.0 seems to have exceptions when loading. Downgrading it to 1.14.1 works.
- Change the last line from
share=is_colab
toshare=True
to enable a public address (as my GPU workstation is remote).