A custom theme for Gradio
Project description
Intel® theme for Gradio
Table of Contents
What is the Intel theme for Gradio
The Intel theme for Gradio uses Gradio's native theming capabilities to apply the Intel brand to a gradio application. It does not have any 3rd party dependencies other than gradio.
How to Use
-
If using a virtual environment (strongly recommended), activate the virtual environment:
source .venv/bin/activate
Or in Windows:
source .venv/Source/activate
-
Install the intel_gradio_theme package:
pip install --prefer-binary git+https://github.com/intel/intel-gradio-theme.git
intel_gradio_theme has release tags and specific versions can be targeted:
pip install --prefer-binary git+https://github.com/intel/intel-gradio-theme.git@v0.1.5
-
Apply the theme to your Gradio app:
import gradio as gr from intel_gradio_theme import SparkTheme demo = gr.Interface(...) theme = SparkTheme() cssstyles = theme.load_css() demo.launch(theme=theme, css=cssstyles)
If Blocks are used to create the interface, then apply the theme to the Blocks
with gr.Blocks(theme=theme, css=cssstyles) as demo:
What This Theme Provides
There are two themes included in this repository:
- Spark Classic Blue is provided by importing
SparkTheme - Spark Tiber is provided by importing
SparkThemeTb
The Spark Classic Blue theme uses the Intel Corporate Brand colors (Blue), while the Spark Tiber theme uses the Intel Tiber colors (aqua, cosmos, cobalt). Unless you know that your product line uses the Intel Tiber Brand, you should use the Spark Classic Blue theme (SparkTheme).
Header & Footer Components
Header
To add a header to your Gradio app using the Intel theme, you can use the header method provided in the SparkTheme class. Here is an example:
from intel_gradio_theme import SparkTheme
demo = gr.Interface(...)
theme = SparkTheme()
demo.launch(theme=theme, components=[theme.header("Welcome to My Gradio App")])
This will add a header with the specified text to your Gradio app.
Footer
To add a footer to your Gradio app using the Intel theme, you can use the footer method provided in the SparkTheme class. Here is an example:
from intel_gradio_theme import SparkTheme
demo = gr.Interface(...)
theme = SparkTheme()
demo.launch(theme=theme, components=[theme.footer("Thank you for using our app")])
This will add a footer with the specified text to your Gradio app.
Troubleshooting
Python dependency troubles
If there are dependency problems, such as being unable to find gradio after installing it, then create a virtual environment and run from there. Read more about using virtual environments in python.
python3 -m venv .venv
...
source .venv/bin/activate
...
export NO_PROXY=intel.com,localhost,127.0.0.1
...
pip install --prefer-binary git+https://github.com/intel/intel-gradio-theme.git
CSS file not found error
If you encounter a FileNotFoundError indicating No such file or directory: '.../intel_gradio_theme/spark.css', it means the CSS file is not being properly included in the package. To fix this please update to version 0.1.7 or newer.
no_proxy environment variable
If you get the following error when running gradio:
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.
ensure your environment variable for no_proxy is set:
export NO_PROXY=intel.com,localhost,127.0.0.1
How to Provide Feedback or Request New Features
- Open an Issue: Go to the Issues tab in the repository, click "New Issue," and describe your feedback or feature request.
Your feedback and feature requests are greatly appreciated and help improve the project!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intel_gradio_theme-1.0.0.tar.gz.
File metadata
- Download URL: intel_gradio_theme-1.0.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1fef881f5db75f2129e7e44b5a6911bacdad2779e0c9d7b87d434d20106344f
|
|
| MD5 |
7218fc0e6dc8562f7b46b8193cbc3583
|
|
| BLAKE2b-256 |
d33418af2b4a3b059f9ebcf0d3f9e18e809c70acea7ee155dd720e572e5d5141
|
Provenance
The following attestation bundles were made for intel_gradio_theme-1.0.0.tar.gz:
Publisher:
semantic-release.yml on intel/intel-gradio-theme
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intel_gradio_theme-1.0.0.tar.gz -
Subject digest:
f1fef881f5db75f2129e7e44b5a6911bacdad2779e0c9d7b87d434d20106344f - Sigstore transparency entry: 248941155
- Sigstore integration time:
-
Permalink:
intel/intel-gradio-theme@0fd7a943d9afe6f095aaf568c759afdbfa051658 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@0fd7a943d9afe6f095aaf568c759afdbfa051658 -
Trigger Event:
push
-
Statement type:
File details
Details for the file intel_gradio_theme-1.0.0-py3-none-any.whl.
File metadata
- Download URL: intel_gradio_theme-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a78a2bd3badbf4a0e628cb3c53b3fd1e309955901773aa66ce8bd5c4a777e7ce
|
|
| MD5 |
801d237e70ce632728942f1c2301d5e0
|
|
| BLAKE2b-256 |
f60eee2dac7e1af933426e57d719d1da365b366bdf2d4855842eff02fc9d73ec
|
Provenance
The following attestation bundles were made for intel_gradio_theme-1.0.0-py3-none-any.whl:
Publisher:
semantic-release.yml on intel/intel-gradio-theme
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intel_gradio_theme-1.0.0-py3-none-any.whl -
Subject digest:
a78a2bd3badbf4a0e628cb3c53b3fd1e309955901773aa66ce8bd5c4a777e7ce - Sigstore transparency entry: 248941158
- Sigstore integration time:
-
Permalink:
intel/intel-gradio-theme@0fd7a943d9afe6f095aaf568c759afdbfa051658 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@0fd7a943d9afe6f095aaf568c759afdbfa051658 -
Trigger Event:
push
-
Statement type: