mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-13 11:57:29 +08:00
removed IPython dependency
This commit is contained in:
parent
5f48867d71
commit
bae3bb1095
@ -456,15 +456,18 @@ class Interface:
|
||||
if inline is None:
|
||||
inline = utils.ipython_check()
|
||||
if inline:
|
||||
from IPython.display import IFrame, display
|
||||
# Embed the remote interface page if on google colab; otherwise, embed the local page.
|
||||
print(strings.en["INLINE_DISPLAY_BELOW"])
|
||||
if share:
|
||||
while not networking.url_ok(share_url):
|
||||
time.sleep(1)
|
||||
display(IFrame(share_url, width=1000, height=500))
|
||||
else:
|
||||
display(IFrame(path_to_local_server, width=1000, height=500))
|
||||
try:
|
||||
from IPython.display import IFrame, display
|
||||
# Embed the remote interface page if on google colab; otherwise, embed the local page.
|
||||
print(strings.en["INLINE_DISPLAY_BELOW"])
|
||||
if share:
|
||||
while not networking.url_ok(share_url):
|
||||
time.sleep(1)
|
||||
display(IFrame(share_url, width=1000, height=500))
|
||||
else:
|
||||
display(IFrame(path_to_local_server, width=1000, height=500))
|
||||
except ImportError:
|
||||
pass # IPython is not available so does not print inline.
|
||||
|
||||
send_launch_analytics(analytics_enabled=self.analytics_enabled, inbrowser=inbrowser, is_colab=is_colab,
|
||||
share=share, share_url=share_url)
|
||||
|
@ -1,7 +1,6 @@
|
||||
import requests
|
||||
import pkg_resources
|
||||
from distutils.version import StrictVersion
|
||||
from IPython import get_ipython
|
||||
analytics_url = 'https://api.gradio.app/'
|
||||
PKG_VERSION_URL = "https://api.gradio.app/pkg-version"
|
||||
|
||||
@ -40,10 +39,11 @@ def colab_check():
|
||||
"""
|
||||
is_colab = False
|
||||
try: # Check if running interactively using ipython.
|
||||
from IPython import get_ipython
|
||||
from_ipynb = get_ipython()
|
||||
if "google.colab" in str(from_ipynb):
|
||||
is_colab = True
|
||||
except NameError:
|
||||
except (ImportError, NameError):
|
||||
error_analytics("NameError")
|
||||
return is_colab
|
||||
|
||||
@ -54,9 +54,10 @@ def ipython_check():
|
||||
:return is_ipython (bool): True or False
|
||||
"""
|
||||
try: # Check if running interactively using ipython.
|
||||
from IPython import get_ipython
|
||||
get_ipython()
|
||||
is_ipython = True
|
||||
except NameError:
|
||||
except (ImportError, NameError):
|
||||
is_ipython = False
|
||||
return is_ipython
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user