mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
fixed thread locking
This commit is contained in:
parent
c2bd77c1a1
commit
978c2dcf1b
@ -412,7 +412,7 @@ class Interface:
|
||||
print("PASSED")
|
||||
continue
|
||||
|
||||
def launch(self, inline=None, inbrowser=None, share=False, debug=False, auth=None, auth_message=None, private_endpoint=None):
|
||||
def launch(self, inline=None, inbrowser=None, share=False, debug=False, auth=None, auth_message=None, private_endpoint=None, prevent_thread_lock=False):
|
||||
"""
|
||||
Parameters:
|
||||
inline (bool): whether to display in the interface inline on python notebooks.
|
||||
@ -518,6 +518,10 @@ class Interface:
|
||||
while True:
|
||||
sys.stdout.flush()
|
||||
time.sleep(0.1)
|
||||
is_in_interactive_mode = bool(getattr(sys, 'ps1', sys.flags.interactive))
|
||||
if not prevent_thread_lock and not is_in_interactive_mode:
|
||||
self.run_until_interrupted(thread, path_to_local_server)
|
||||
|
||||
|
||||
return app, path_to_local_server, share_url
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user