Skip to content

Commit

Permalink
add wip gradio
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Aug 28, 2023
1 parent 9174198 commit 3f02d72
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
10 changes: 10 additions & 0 deletions jhub_apps/examples/gradio_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import gradio as gr


def greet(name):
return "Hello " + name + "!"


demo = gr.Interface(fn=greet, inputs="text", outputs="text")

demo.launch()
1 change: 1 addition & 0 deletions jhub_apps/launcher/panel_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class InputFormWidget:
"bokeh": "https://static.bokeh.org/branding/icons/[email protected]",
"voila": "https://raw.githubusercontent.com/voila-dashboards/voila/main/docs/voila-logo.svg",
"plotlydash": "https://repository-images.githubusercontent.com/33702544/b4400c80-718b-11e9-9f3a-306c07a5f3de",
"gradio": "https://avatars.githubusercontent.com/u/51063788?s=48&v=4",
}


Expand Down
20 changes: 15 additions & 5 deletions jhub_apps/spawner/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
DEFAULT_CMD = ["python", "-m", "jhsingle_native_proxy.main", "--authtype=none"]

# TODO: Fix this hardcoding
BASE_EXAMPLES_PATH = "/Users/aktech/quansight/jhub-apps/jhub_apps/examples"
EXAMPLES_PATH = {
"panel": "/Users/aktech/quansight/jhub-apps/jhub_apps/examples/panel_basic.py",
"bokeh": "/Users/aktech/quansight/jhub-apps/jhub_apps/examples/bokeh_basic.py",
"streamlit": "/Users/aktech/quansight/jhub-apps/jhub_apps/examples/streamlit_app.py",
"plotlydash": "/Users/aktech/quansight/jhub-apps/jhub_apps/examples/plotlydash_app.py",
"voila": "/Users/aktech/quansight/jhub-apps/jhub_apps/examples/voila_basic.ipynb",
"panel": f"{BASE_EXAMPLES_PATH}/panel_basic.py",
"bokeh": f"{BASE_EXAMPLES_PATH}/bokeh_basic.py",
"streamlit": f"{BASE_EXAMPLES_PATH}/streamlit_app.py",
"plotlydash": f"{BASE_EXAMPLES_PATH}/plotlydash_app.py",
"voila": f"{BASE_EXAMPLES_PATH}/voila_basic.ipynb",
"gradio": f"{BASE_EXAMPLES_PATH}/gradio_basic.py",
}

base_url = "http://127.0.0.1:8000"
origin_host = "127.0.0.1:8000"


COMMANDS = {
"gradio": {
"args": [
"--destport=0",
"python",
f'{EXAMPLES_PATH.get("gradio")}',
"--ready-check-path=/",
],
},
"voila": {
"args": [
"--destport=0",
Expand Down

0 comments on commit 3f02d72

Please sign in to comment.