added article, hosted information

This commit is contained in:
Ali Abid 2020-12-03 11:47:08 -08:00
parent 9f32bd70ab
commit abfb70940b
6 changed files with 24 additions and 3 deletions

View File

@ -244,6 +244,10 @@ Links expire after 6 hours. Need longer links, or private links? [Contact us fo
![Sharing diagram](demo/images/sharing.svg)
### Permanent Hosting
You can share your interface publicly and permanently by hosting on Gradio's infrastructure. You will need to create a Gradio premium account. First, log into Gradio on [gradio.app](https://gradio.app) and click Sign In at the top. Once you've logged in with your Github account, you can specify which repositories from your Github profile you'd like to have hosted by Gradio. You must also specify the file within the repository that runs the Gradio `launch()` command. Once you've taken these steps, Gradio will launch your interface on a URL of the format **XXXXXX.gradio.app** where **XXXXXX** is any string you specify.
## Contributing:
If you would like to contribute and your contribution is small, you can directly open a pull request (PR). If you would like to contribute a larger feature, we recommend first creating an issue with a proposed design for discussion. Please see our contributing guidelines for more info.

View File

@ -10,3 +10,4 @@ scikit-learn
scikit-image
analytics-python
pandas
markdown2

View File

@ -18,6 +18,7 @@ import analytics
import numpy as np
import os
import copy
import markdown2
analytics.write_key = "uxIFddIEuuUcFLf9VgH2teTEtPlWdkNy"
analytics_url = 'https://api.gradio.app/'
@ -41,7 +42,7 @@ class Interface:
examples_per_page=10, live=False,
layout="horizontal", show_input=True, show_output=True,
capture_session=False, interpretation=None,
title=None, description=None, thumbnail=None,
title=None, description=None, article=None, thumbnail=None,
server_port=None, server_name=networking.LOCALHOST_NAME,
allow_screenshot=True, allow_flagging=True,
embedding="default", flagging_dir="flagged", analytics_enabled=True):
@ -60,6 +61,7 @@ class Interface:
interpretation (Union[Callable, str]): function that provides interpretation explaining prediction output. Pass "default" to use built-in interpreter.
title (str): a title for the interface; if provided, appears above the input and output components.
description (str): a description for the interface; if provided, appears above the input and output components.
article (str): an expanded article explaining the interface; if provided, appears below the input and output components. Accepts Markdown and HTML content.
thumbnail (str): path to image or src to use as display picture for models listed in gradio.app/hub
server_name (str): to make app accessible on local network set to "0.0.0.0".
allow_screenshot (bool): if False, users will not see a button to take a screenshot of the interface.
@ -115,6 +117,9 @@ class Interface:
self.server_name = server_name
self.title = title
self.description = description
if article is not None:
article = markdown2.markdown(article)
self.article = article
self.thumbnail = thumbnail
self.examples = examples
self.examples_per_page = examples_per_page
@ -186,6 +191,7 @@ class Interface:
"show_output": self.show_output,
"title": self.title,
"description": self.description,
"article": self.article,
"thumbnail": self.thumbnail,
"allow_screenshot": self.allow_screenshot,
"allow_flagging": self.allow_flagging,

View File

@ -59,7 +59,9 @@ function gradio(config, fn, target, example_file_path) {
<table class="examples-content">
</table>
<div class="plot embeddings-content invisible"><canvas id="canvas" width="400px" height="300px"></canvas></div>
</div>`);
</div>
<p class="article"></p>
`);
let io_master = Object.create(io_master_template);
io_master.fn = fn
io_master.target = target;
@ -109,6 +111,9 @@ function gradio(config, fn, target, example_file_path) {
if (config["description"]) {
target.find(".description").text(config["description"]);
}
if (config["article"]) {
target.find(".article").html(config["article"]);
}
if (config["share_url"]) {
let share_url = config["share_url"];
target.find(".share").removeClass("invisible");

View File

@ -124,6 +124,10 @@ Links expire after 6 hours. Need longer links, or private links? [Contact us fo
![Sharing diagram](demo/images/sharing.svg)
### Permanent Hosting
You can share your interface publicly and permanently by hosting on Gradio's infrastructure. You will need to create a Gradio premium account. First, log into Gradio on [gradio.app](https://gradio.app) and click Sign In at the top. Once you've logged in with your Github account, you can specify which repositories from your Github profile you'd like to have hosted by Gradio. You must also specify the file within the repository that runs the Gradio `launch()` command. Once you've taken these steps, Gradio will launch your interface on a URL of the format **XXXXXX.gradio.app** where **XXXXXX** is any string you specify.
## Contributing:
If you would like to contribute and your contribution is small, you can directly open a pull request (PR). If you would like to contribute a larger feature, we recommend first creating an issue with a proposed design for discussion. Please see our contributing guidelines for more info.

View File

@ -25,6 +25,7 @@ setup(
'scikit-learn',
'scikit-image',
'analytics-python',
'pandas'
'pandas',
'markdown2'
],
)