示例#1
0
The Google Maps example was initially described in the [Param User Guide]\
(https://panel.holoviz.org/user_guide/Param.html).
"""
import panel as pn
import param
from awesome_panel_extensions.frameworks.fast.templates import FastGridTemplate

from application.config import site

APPLICATION = site.create_application(
    url="google-map-viewer",
    name="Google Map Viewer",
    author="Andrew Huang",
    introduction="An app showcasing the use of Google Maps and the FastGridTemplate",
    description=__doc__,
    thumbnail_url="google-map-viewer.png",
    code_url="discourse/discourse_1533_template_with_map.py",
    mp4_url="google-map-viewer.mp4",
    tags=["Panel", "Param", "Grid", "Google", "Map"],
)


class GoogleMapViewer(param.Parameterized):
    """An app showcasing how Param and Google Maps can be composed into an app
    using the FastGridTemplate"""

    continent = param.ObjectSelector(default="Asia", objects=["Africa", "Asia", "Europe"])

    country = param.ObjectSelector(default="China", objects=["China", "Thailand", "Japan"])
示例#2
0
from panel.pane import Markdown

from application.config import site

RESOURCES_PATH = pathlib.Path(__file__).parent / "resources.md"
RESOURCES = RESOURCES_PATH.read_text()
APPLICATION = site.create_application(
    url="awesome-list",
    name="Awesome List",
    author="Marc Skov Madsen",
    introduction=
    """A list of Awesome Panel Resources created by the community""",
    description=__doc__,
    thumbnail_url="resources.png",
    documentation_url="",
    code_url="resources/resources.py",
    gif_url="",
    mp4_url="",
    tags=[
        "Code",
        "App In Gallery",
    ],
)


@site.add(APPLICATION)
def view():
    """The resources view of awesome-panel.org"""
    main = [Markdown(RESOURCES, sizing_mode="stretch_width")]
    template = site.create_template(main=main)
示例#3
0
from application.config import site
from application.pages.loading_spinners import config

if STYLE not in pn.config.raw_css:
    pn.config.raw_css.append(STYLE)

COLOR = "#E1477E"

APPLICATION = site.create_application(
    url="loading-spinners",
    name="Loading Spinners",
    author="Marc Skov Madsen",
    introduction="Demonstrates the look and feel of the Loading Spinners",
    description=__doc__,
    thumbnail_url="loading-spinners.png",
    documentation_url="",
    code_url="loading_spinners/loading_spinners.py",
    gif_url="loading-spinners.gif",
    mp4_url="loading-spinners.mp4",
    tags=["UX"],
)


class LoadingStyler(param.Parameterized):
    """A utility that can be used to select and style the loading spinner"""

    spinner = param.ObjectSelector(default=DEFAULT_URL,
                                   objects=config.SPINNERS,
                                   doc="The loading spinner to use")
    spinner_height = param.Integer(50, bounds=(1, 100))
示例#4
0
import panel as pn
from awesome_panel import express as pnx
from awesome_panel.express.testing import TestApp

from application.config import site

COLOR = "#E1477E"

APPLICATION = site.create_application(
    url="bootstrap-card",
    name="Bootstrap Card",
    author="Marc Skov Madsen",
    introduction="Demonstrates the look and feel of the Panel Cards",
    description=__doc__,
    thumbnail_url="test_bootstrap_card.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_bootstrap_card.py",
    gif_url="",
    mp4_url="",
    tags=[
        "Bootstrap",
    ],
)

TEXT = """\
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.
3 wolf moon officia aute, non cupidatat skateboard dolor brunch.
Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on
 it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft
 beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo.
 Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably
DATE_COLUMNS = [
    "created_at",
]
N_SAMPLES = 10000
CMAP = {
    "canceled": "#E0BB5E",
    "failed": "#E1477E",
    "successful": "#31E040",
    "suspended": "#3D69E0",
}
APPLICATION = site.create_application(
    url="kick-starter-dashboard",
    name="Kickstarter Dashboard",
    author="Marc Skov Madsen",
    introduction=
    "A dashboard with fast and responsive linked brushing of the plots",
    description=__doc__,
    thumbnail_url="kickstarter_dashboard.png",
    code_url="kickstarter_dashboard/kickstarter_dashboard.py",
    tags=["Bokeh", "Linked Brushing"],
)


class KickstarterDashboard(param.Parameterized):
    # pylint: disable=line-too-long
    """The purpose of the Kickstarter Dashboard is to test if the claims regarding Bokeh as of Jan 2018 in the
    [bokeh-dash-best-dashboard-framework](https://www.sicara.ai/blog/2018-01-30-bokeh-dash-best-dashboard-framework-python)
    article holds for Panel and the HoloViews suite of tools as of Dec 2019.

    The claims where
from scipy import signal, stats

from application.config import site

hv.extension("bokeh")

cache = FanoutCache(".cache")

APPLICATION = site.create_application(
    url="volume-profile-analysis",
    name="Volume Profile Analysis",
    author="Marc Skov Madsen",
    introduction=
    """An example of Volume Profile Analysis of time series from commodity, currency,
    debt and equity markets.""",
    description=__doc__,
    thumbnail_url="volume-profile-analysis.png",
    code_url="volume_profile_analysis/volume_profile_analysis.py",
    mp4_url="volume-profile-analysis.mp4",
    tags=[
        "Panel", "HoloViz", "Volume Profiles", "Finance", "Quant",
        "Signal Processing"
    ],
)

ROOT = pathlib.Path(__file__).parent
DATA_PATH = ROOT / "bs_btcusd_ohlcv_1h_2020.csv.gz"
DATA_URL = (
    "https://cdn.shopify.com/s/files/1/1365/1139/files/bs_btcusd_ohlcv_1h_2020.csv.gz?v=1585597359"
)
ACCENT_COLOR = "#C01754"
# Source: https://mycolor.space/?hex=%23C01754&sub=1
COLOR = "#E1477E"

IMAGE_PATH = (pathlib.Path(__file__).parent / "assets" / "images" /
              "bootstrap_dashboard_template_original.png")
DESCRIPTION = """\
The purpose of this app is to test that a **multi-page Dashboard Layout** similar to the [bootstrap dashboard template](https://getbootstrap.com/docs/4.3/examples/dashboard/) from [getboostrap.com](https://getbootstrap.com/) can be implemented in [Panel](https://panel.pyviz.org/).

"""
APPLICATION = site.create_application(
    url="bootstrap-dashboard",
    name="Bootstrap Dashboard",
    author="Marc Skov Madsen",
    introduction="Demonstrates a Bootstrap styled dashboard with Panel",
    description=DESCRIPTION,
    thumbnail_url="bootstrap_dashboard.png",
    documentation_url="",
    code_url="bootstrap_dashboard/main.py",
    gif_url="",
    mp4_url="",
    tags=[
        "Bootstrap",
    ],
)


@site.add(APPLICATION)
def view() -> pn.Column:
    """# Bootstrap Dashboard Page.

    Creates a Bootstrap Dashboard Page with a Chart and a Table
import panel as pn
import plotly.express as px
from streamz.dataframe import DataFrame as sDataFrame

from application.config import site

alt.themes.enable("dark")

APPLICATION = site.create_application(
    url="streaming-plots",
    name="Streaming Plots",
    author="Marc Skov Madsen",
    introduction="Demonstrates Streaming with Panel",
    description=__doc__,
    thumbnail_url="streaming-plots.png",
    documentation_url="",
    code_url="streaming_plots/streaming_plots.py",
    gif_url="streaming-plots.gif",
    mp4_url="streaming-plots.mp4",
    tags=[
        "Streaming",
        "Streamz",
    ],
)
COLOR = "#E1477E"
THEME = {
    pn.template.theme.DarkTheme: {pn.pane.ECharts: "dark", pn.pane.Plotly: "plotly_dark"},
    pn.template.theme.DefaultTheme: {pn.pane.ECharts: "default", pn.pane.Plotly: "plotly_white"},
}


def _create_echarts(data):
示例#9
0
This example was developed as a response to
[Discourse Post 949]\
(https://discourse.holoviz.org/t/\
using-panel-with-javascript-to-make-a-copy-text-to-clipboard-button/949)
by [ShanzyHolm](https://discourse.holoviz.org/u/ShanzyHolm/summary).
"""
import panel as pn

from application.config import site

APPLICATION = site.create_application(
    url="js-actions",
    name="JS Actions",
    author="Marc Skov Madsen",
    introduction="Shows how to use a little bit of javascript with Panel",
    description=__doc__,
    thumbnail_url="js_actions.png",
    code_url="js_actions/js_actions.py",
    tags=[
        "JavaScript",
    ],
)
STYLE = """
<style>
.app-bar {
    color: white;
}
</style>
"""


def copy_to_clipboard():
示例#10
0
import datetime

import hvplot.pandas  # pylint: disable=unused-import
import pandas as pd
import panel as pn
import param

from application.config import site

APPLICATION = site.create_application(
    url="param-reference",
    name="Param Reference Example",
    author="Marc Skov Madsen",
    introduction="A live version of the Panel Param Reference guide",
    description=__doc__,
    thumbnail_url="param_reference_example.png",
    code_url="param_reference_example/param_reference_example.py",
    tags=[
        "Param",
    ],
)

COLOR = "#E1477E"
DATE_BOUNDS = (
    datetime.date(
        1900,
        1,
        1,
    ),
    datetime.datetime.now().date(),
)
    gspec[2:7, 4:14] = plot_horizontal_bar_pane
    gspec[7:10, 0:7] = bound_plotly_line_plot_pane
    gspec[7:10, 7:14] = bound_plotly_scatter_plot_pane
    gspec[11, 0:14] = pn.Row(pn.Spacer(), CSS_PANE)

    return gspec


APPLICATION = site.create_application(
    url="soccer-analytics-dashboard",
    name="Soccer Analytics Dashboard",
    author="Stephen Kilcommins",
    introduction="A nice sports app with a nice background",
    description=__doc__,
    thumbnail_url="soccer-analytics-dashboard.png",
    documentation_url=
    ("https://medium.datadriveninvestor.com/panel-everything-you-need-to-know-9bca61532e12"
     ),
    code_url="soccer_analytics_dashboard",
    tags=["Panel", "Review", "Blog", "Soccer", "Plotly"],
)


@site.add(APPLICATION)
def view():
    """Returns the applications for use in the site"""
    return _create_app()


if __name__.startswith("bokeh"):
from application.config import site

MODELVIEWER_LOGO = '<img src="https://avatars1.githubusercontent.com/u/1342004?v=4&amp;s=40" style="height:50px"></img>'
PANEL_LOGO = (
    '<img src="https://panel.holoviz.org/_static/logo_stacked.png" style="height:50px"></img>'
)
BLUE = "#5dbcd2"
GRAY = "#eeeeee"
APPLICATION = site.create_application(
    url="model-viewer",
    name="Model Viewer",
    author="Marc Skov Madsen",
    introduction=
    """Demonstrates the look and feel of the Google ModelViewer in your Panel app""",
    description=__doc__,
    thumbnail_url="test_model_viewer.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_model_viewer.py",
    gif_url="",
    mp4_url="",
    tags=["model-viewer"],
)


def create_app(**params):
    pn.config.sizing_mode = "stretch_width"
    template = pn.template.FastListTemplate(title="Test Model Viewer")
    if "dark" in str(template.theme).lower():
        background = template.theme.style.neutral_fill_card_rest
    else:
        background = GRAY
示例#13
0
Please note that the available voices and languages depend on your browser and os. For the best
experience **use Chrome**.
"""
import panel as pn
from panel.widgets import TextToSpeech

from application.config import site

APPLICATION = site.create_application(
    url="text-to-speech",
    name="Text To Speech",
    author="Marc Skov Madsen",
    introduction="Demonstrates the powerful TextToSpeech widget",
    description=__doc__,
    thumbnail_url="text-to-speech.png",
    documentation_url="",
    code_url="text_to_speech/text_to_speech.py",
    gif_url="text-to-speech.gif",
    mp4_url="text-to-speech.mp4",
    tags=[
        "TextToSpeech",
    ],
)

TEXT = """By Aesop

There was a time, so the story goes, when all the animals lived together in harmony. The lion
didn’t chase the oxen, the wolf didn’t hunt the sheep, and owls didn’t swoop on the mice in the
field.

Once a year they would get together and choose a king, who would then reign over the animal
示例#14
0
from bokeh.core.properties import Instance, String
from bokeh.layouts import column
from bokeh.models import HTMLBox, Slider

from application.config import site

CUSTOM_TS = pathlib.Path(__file__).parent / "custom_bokeh_model.ts"
CUSTOM_TS_STR = str(CUSTOM_TS.resolve())
APPLICATION = site.create_application(
    url="custom-bokeh-model",
    name="Custom Bokeh Model",
    author="Marc Skov Madsen",
    introduction="""An introduction to Bokeh/ Panel extensions""",
    description=__doc__,
    thumbnail_url="custom_bokeh_model.png",
    documentation_url="",
    code_url="custom_bokeh_model/custom_bokeh_model.py",
    gif_url="",
    mp4_url="",
    tags=[
        "Code",
        "App In Gallery",
    ],
)


class Custom(HTMLBox):
    """Example implementation of a Custom Bokeh Model"""

    __implementation__ = CUSTOM_TS_STR

    text = String(default="Custom text")
    "Key Statistics": "key_stats",
    "Major Holders": "major_holders",
    "Pricing": "price",
    "Quote Type": "quote_type",
    "Recommendation Trends": "recommendation_trend",
    "SEC Filings": "sec_filings",
    "Share Purchase Activity": "share_purchase_activity",
    "Summary Detail": "summary_detail",
    "Summary Profile": "summary_profile",
}
APPLICATION = site.create_application(
    name="Yahoo Query",
    introduction="Shows how you can use the Yahoo Query package in your Panel apps",
    description=__doc__,
    url="yahoo-query",
    thumbnail_url="yahooquery_app.png",
    code_url="yahooquery_app/yahooquery_app.py",
    mp4_url="",
    gif_url="",
    author="Marc Skov Madsen",
    tags=["Finance", "api"],
)


class YahooQueryService:
    """Wrapper around the yahooquery package"""

    @classmethod
    @lru_cache(2048)
    def get_data(
        cls,
        symbols: str,
示例#16
0
import time

import panel as pn
from awesome_panel.express.testing import TestApp
from awesome_panel_extensions.widgets.progress_ext import ProgressExt

from application.config import site

APPLICATION = site.create_application(
    url="progress-extension",
    name="Progress Extension",
    author="Marc Skov Madsen",
    introduction=
    """Demonstrates how to easily add progress reporting using the ProgressExt
    widget""",
    description=__doc__,
    thumbnail_url="test_progress_ext.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_progress_ext.py",
    gif_url="",
    mp4_url="",
    tags=["Progress"],
)


def test_view_value_and_message():
    """We test the view with a value and a message

    - The progress bar is active with the value 50
    - The message hello world is visible
    - The bar color is the blue *info* color
示例#17
0
"""The Awesome Panel Gallery based on the Fast Components"""
# pylint: disable=line-too-long
import panel as pn
from awesome_panel_extensions.frameworks.fast.templates.fast_gallery_template import (
    FastGalleryTemplate,
)

from application.config import site

APPLICATION = site.create_application(
    url="gallery",
    name="Gallery",
    author="Marc Skov Madsen",
    introduction="""A custom Panel template using the Fast
    web components""",
    description="""The Gallery provides a very visual overview to the applications and associated
    resources""",
    thumbnail_url="gallery.png",
    documentation_url="",
    code_url="fast_gallery/fast_gallery.py",
    gif_url="",
    mp4_url="",
)


@site.add(APPLICATION)
def view():
    """Return a FastGalleryTemplate"""
    pn.config.raw_css = [
        css for css in pn.config.raw_css if not css.startswith("/* CUSTOM TEMPLATE CSS */")
    ]
    return FastGalleryTemplate(
from holoviews import opts
from panel.template import FastGridTemplate
from plotly.data import iris

from application.config import site

hv.extension("bokeh", "plotly")

APPLICATION = site.create_application(
    url="holoviews-linked-brushing",
    name="HoloViews Linked Brushing",
    author="Marc Skov Madsen",
    introduction=
    "A demonstration of HoloViews linked brushing for Bokeh and Plotly backends",
    description=__doc__,
    thumbnail_url="holoviews-linked-brushing.png",
    code_url="holoviews_linked_brushing.py",
    mp4_url="holoviews-linked-brushing.mp4",
    tags=[
        "Panel", "Bokeh", "Plotly", "HoloViews", "Linked Brushing",
        "Cross Filter"
    ],
)


def _plotly_hooks(plot, element):
    """Used by HoloViews to give plots plotly plots special treatment"""
    fig = plot.state
    # Use plot hook to set the default drag mode to box selection
    fig["layout"]["dragmode"] = "select"
"""
import holoviews as hv
import numpy as np
import panel as pn

from application.config import site

APPLICATION = site.create_application(
    url="dependent-widgets",
    name="Dependent Widgets",
    author="Marc Skov Madsen",
    introduction=
    "An example of providing multiple widgets to select the same value",
    description=__doc__,
    thumbnail_url="dependent-widgets.png",
    documentation_url="",
    code_url="discourse/discourse_1478_dependent_widgets.py",
    gif_url="dependent-widgets.gif",
    mp4_url="dependent-widgets.mp4",
    tags=[
        "Discourse",
        "Multiselect",
    ],
)

CONTINENTS = ["Asia", "Europe", "America"]
CITIES = {
    "Asia": ["Singapore", "Seoul", "Shanghai"],
    "America": ["Boston", "Toronto", "Quito", "Santiago"],
    "Europe": ["Madrid", "London", "Paris", "Lisbon"],
}
(https://discourse.holoviz.org/t/how-to-use-ngl-webgl-protein-viewer-in-panel/583).
"""

import panel as pn
import param
from awesome_panel_extensions.widgets.ngl_viewer import NGLViewer
from panel.template import FastListTemplate

from application.config import site

APPLICATION = site.create_application(
    url="ngl-molecule-viewer",
    name="NGL Molecule Viewer",
    author="Jochem Smit",
    introduction="Demo of the the NGL Molecule Viewer widget",
    description=__doc__,
    thumbnail_url="ngl-molecule-viewer.png",
    code_url="ngl_molecule_viewer.py",
    mp4_url="ngl-molecule-viewer.mp4",
    tags=["Panel", "NGL", "Molecule"],
)

DEFAULT_RCSB_ID = "1NKT"


class ProteinViewer(param.Parameterized):
    """This is an example of a Protein viewer app, using the [NGL Viewer]\
(https://github.com/nglviewer/ngl)."""

    input_option = param.Selector(default="RCSB PDB", objects=["RCSB PDB", "Upload File"])
    rcsb_id = param.String(default=DEFAULT_RCSB_ID)
示例#21
0
import awesome_panel.express as pnx
import pandas as pd
import panel as pn
from awesome_panel.express.testing import TestApp
from awesome_panel_extensions.widgets import dataframe

from application.config import site

APPLICATION = site.create_application(
    url="dataframe-formatting",
    name="Dataframe Formatting",
    author="Marc Skov Madsen",
    introduction="""Demonstrates how to style and format the DataFrame widget easily""",
    description=__doc__,
    thumbnail_url="test_dataframe.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_dataframe.py",
    gif_url="",
    mp4_url="",
    tags=["DataFrame"],
)


def test_get_default_formatters():
    """We test the `awesome_panel_extensions.widgets.dataframe.get_default_formatters` function
    applied to a DataFrame.

    We expect to see to see a `pn.widgets.DataFrame` with

    - ints aligned right, with zero decimals and ',' as thousands separator
示例#22
0
from awesome_panel_extensions.frameworks.fast.templates import FastListTemplate
from diskcache import FanoutCache

from application.config import site

hv.extension("bokeh")


cache = FanoutCache(".cache", name="all")

APPLICATION = site.create_application(
    url="caching-example",
    name="Caching Example",
    author="Marc Skov Madsen",
    introduction="""An app demonstrating how to speed up your app using caching.""",
    description=__doc__,
    thumbnail_url="caching-example.png",
    code_url="caching_example/caching_example.py",
    mp4_url="caching-example.mp4",
    tags=["Panel", "Caching"],
)

ACCENT_COLOR = "#C01754"

CACHE_EXPIRY = 60 * 60 * 24  # seconds, i.e. one Day


np.random.seed([3, 1415])
PERIODS = 1 * 24 * 60  # minutes. I.e. 1 days
DATA = pd.DataFrame(
    {
示例#23
0
from application.config import site

COLOR = "#E1477E"
EMPTY_DATAFRAME = pd.DataFrame(columns=["x", "y"])
EMPTY_PLOT = hv.Div("Click UPDATE to load!")
SPINNER_URL = (
    "https://github.com/MarcSkovMadsen/awesome-panel/blob/master/"
    "application/pages/gallery/dataexplorer_loading/spinner.gif?raw=true")
SPINNER_HTML = f"<img application='{SPINNER_URL}' style='width:100%'"
APPLICATION = site.create_application(
    url="data-explorer-loading",
    name="Data Explorer Loading",
    author="Marc Skov Madsen",
    introduction=
    "Shows how to provide progress information to a user during computation",
    description=__doc__,
    thumbnail_url="dataexplorer_loading.png",
    documentation_url="",
    code_url="dataexplorer_loading/dataexplorer_loading.py",
    gif_url="",
    mp4_url="",
    tags=[],
)


class DataExplorer(param.Parameterized):
    """The DataExplorer App illustrates a progress and loading message"""

    load_time = param.Integer(default=8,
                              bounds=(1, 4 * 16),
                              label="Load Time (seconds)")
    data = param.DataFrame()
示例#24
0
PANEL_LOGO = "https://panel.holoviz.org/_static/logo_horizontal.png"
ROOT = pathlib.Path(__file__).parent
# Source: https://datahub.io/core/s-and-p-500-companies-financials
DATA = ROOT / "PerspectiveViewerData.csv"
VIDEO = """<iframe width="100%" height="400" src="https://www.youtube.com/embed/IO-HJsGdleE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>"""
INFO = """**You can also use the `Perspective` pane in your apps**. Check out the [Perspective Reference Guide]\
(https://panel.holoviz.org/reference/panes/Perspective.html) or the video below.
"""

APPLICATION = site.create_application(
    url="perspective",
    name="Perspective Viewer",
    author="Marc Skov Madsen",
    introduction=
    """Demonstrates that you can use the awesome Perspective pane""",
    description=__doc__,
    thumbnail_url="test_perspective.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_perspective.py",
    gif_url="",
    mp4_url="",
    tags=["Perspective", "Streaming"],
)
COLUMNS = [
    "Name",
    "Symbol",
    "Sector",
    "Price",
    "Price/Earnings",
    "Dividend Yield",
    "Earnings/Share",
    "52 Week Low",
示例#25
0
If you want a nicer looking `FileInput` in Panel please upvote
[Github Issue 917](https://github.com/holoviz/panel/issues/917) and join the discussion in
[Discourse 1128](https://discourse.holoviz.org/t/what-should-a-better-fileinput-look-like/1128/3).
"""
import panel as pn

from application.config import site

APPLICATION = site.create_application(
    url="fileinput-area",
    name="FileInput Area",
    author="Marc Skov Madsen",
    introduction=
    """Shows how to style the Panel FileInput to give it a modern look and feel""",
    description=__doc__,
    thumbnail_url="fileinput-area.png",
    documentation_url="",
    code_url="styling/fileinput-area.py",
    gif_url="",
    mp4_url="",
    tags=["Styling", "FileInput"],
)

STYLE = """
<style>
.pnx-file-upload-area input[type=file] {
    width: 100%;
    height: 100%;
    border: 3px dashed #9E9E9E;
    background: transparent;
    border-radius: 5px;
示例#26
0
import panel as pn
import param
from PIL import Image

from application.config import site

pn.extension("vega")

APPLICATION = site.create_application(
    url="image-classifier",
    name="Image Classifier",
    author="Marc Skov Madsen",
    introduction="An image classifier app created with Panel",
    description=__doc__,
    thumbnail_url="image_classifier.png",
    documentation_url="",
    code_url="image_classifier/image_classifier.py",
    gif_url="",
    mp4_url="",
    tags=[
        "Keras",
    ],
)


class KerasApplication(NamedTuple):
    """We wrap a Keras Application into this class for ease of use"""

    name: str
    keras_application: Callable
    preprocess_input_func: Callable  # = imagenet_utils.preprocess_input
    ShareOnFacebook,
    ShareOnLinkedIn,
    ShareOnMail,
    ShareOnReddit,
    ShareOnTwitter,
)

from application.config import site

APPLICATION = site.create_application(
    url="share-on-social-buttons",
    name="Share On Social Buttons",
    author="Marc Skov Madsen",
    introduction="""These widgets makes it easy to add "share on social" buttons to your
    apps""",
    description=__doc__,
    thumbnail_url="test_share_links.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_share_links.py",
    gif_url="",
    mp4_url="",
    tags=["Social Media", "Buttons"],
)


@site.add(APPLICATION)
def view() -> pn.Column:
    """Wraps all tests in a Column that can be included in the Gallery or served independently

    Returns:
        pn.Column -- A Column containing all the tests
    """
    border-color: #174c4f;
    color: #cc5c29;
    font-weight: 500;
}
iframe {
    width:100%;
    height:800px;
}
</style>
"""
APPLICATION = site.create_application(
    url="pandas-profiling",
    name="Pandas Profiling",
    author="Marc Skov Madsen",
    introduction="""Demonstrates that you can embed HTML reports like the Panel Profiling report in
    your apps""",
    description=__doc__,
    thumbnail_url="pandas_profiling_app.png",
    code_url="pandas_profiling_app/pandas_profiling_app.py",
    tags=["Pandas", "HTML", "embed"],
)


class Config(param.Parameterized):
    """Pandas Profiling Configuration Settings"""

    title = param.String(default=DEFAULT_TITLE)
    minimal = param.Boolean(False)


class PandasProfilingApp(param.Parameterized):  # pylint: disable=too-many-instance-attributes
示例#29
0
def _read_sections():
    sections = SECTIONS_PATH.read_text()
    sections = sections.split("##")
    sections[0] = Markdown(sections[0])
    for index in range(1, len(sections)):
        sections[index] = Markdown("#" + sections[index])
    return sections


SECTIONS = _read_sections()
APPLICATION = site.create_application(
    url="/",
    name="Awesome Panel",
    author="Marc Skov Madsen",
    introduction="An introduction to awesome-panel.org and Panel",
    description="An introduction to awesome-panel.org and Panel",
    thumbnail_url="home.png",
    documentation_url="",
    code_url="home/home.py",
    gif_url="home.gif",
    mp4_url="home.mp4",
)


@site.add(APPLICATION)
def view():
    """The home view of awesome-panel.org"""
    pn.config.sizing_mode = "stretch_width"
    template = site.create_template(main=SECTIONS, main_max_width="900px")
    return template

示例#30
0
"""Panel does not have a pane for code. I've created a `Code` pane in the
[`awesome_panel_extensions`](https://pypi.org/project/awesome-panel-extensions/) package"""

import panel as pn
from awesome_panel.express.testing import TestApp
from awesome_panel_extensions.pane import Code

from application.config import site

APPLICATION = site.create_application(
    url="code-pane",
    name="Code Pane",
    author="Marc Skov Madsen",
    introduction=
    "Demonstrates the Code pane from the awesome-panel-extensions package",
    description=__doc__,
    thumbnail_url="test_code.png",
    documentation_url="",
    code_url="awesome_panel_express_tests/test_code.py",
    gif_url="",
    mp4_url="",
    tags=["awesome-panel-extensions", "Pane"],
)


def test_code():
    """A manual test of the Code pane.

    We expect to see nicely formatted Python code"""

    code = """\
def my_add(a,b):