article from readme

This commit is contained in:
aliabd 2021-02-12 16:28:12 -08:00
parent 77cc389ebd
commit 9be0a630de
2 changed files with 14 additions and 1 deletions

View File

@ -127,6 +127,7 @@ class Interface:
self.title = title
self.description = description
if article is not None:
article = utils.readme_to_html(article)
article = markdown2.markdown(article)
self.article = article
self.thumbnail = thumbnail

View File

@ -5,6 +5,7 @@ from IPython import get_ipython
analytics_url = 'https://api.gradio.app/'
PKG_VERSION_URL = "https://api.gradio.app/pkg-version"
def version_check():
try:
current_pkg_version = pkg_resources.require("gradio")[0].version
@ -18,6 +19,7 @@ def version_check():
except: # TODO(abidlabs): don't catch all exceptions
pass
def error_analytics(type):
"""
Send error analytics if there is network
@ -56,4 +58,14 @@ def ipython_check():
is_ipython = True
except NameError:
is_ipython = False
return is_ipython
return is_ipython
def readme_to_html(article):
try:
response = requests.get(article)
if response.status_code == requests.codes.ok:
article = response.text
except requests.exceptions.MissingSchema:
pass
return article