Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 5 min read How-to mediumAdept

Visualize proteins on Hugging Face Spaces

Protein structures can be rendered inside a Gradio app on Hugging Face Spaces by embedding 3Dmol.js in an HTML block via an iframe srcdoc, which works around browser security rules. The walkthrough builds a viewer that accepts a 4-character PDB code (fetched from RCSB) or an uploaded PDB file, injects the file contents into a template literal, and configures the 3Dmol viewer's style, zoom and container size. A May 2024 update recommends the gradio_molecule3d custom component instead, which supports on-the-fly representation changes, and the ProteinMPNN space is cited as a production example.

Assumes: Gradio basicsJavaScript/jQuery basicsPDB file format

Related posts

  • How an Agent Built a 3D Paris Gallery by Chaining Two Hugging Face Spaces

    Hugging Face mediumAdept

    Every Gradio Space on Hugging Face now exposes a plain-text agents.md describing its API schema, call/poll endpoints, file upload and auth, so a coding agent can drive a Space with no client library. A coding agent chained an image-generation Space (ideogram4) with VAST-AI/TripoSplat to produce single-image 3D Gaussian splats of Paris monuments. It also handled the glue work: flipping Y-down outputs upright, auto-framing, compressing .ply to .ksplat (~3× smaller), building a Three.js viewer and deploying a static Space. Reusing the same pipeline for Japan and Egypt galleries took one prompt each, which the author offers as evidence for Mitchell Hashimoto's 'building block economy' applied to multimedia models.

  • One-Shot Any Web App with Gradio's gr.HTML

    Hugging Face mediumAdept

    Gradio 6's gr.HTML now accepts an html_template, scoped css_template and js_on_load script, so a fully custom interactive component (frontend, backend and state) fits in one Python file that an LLM can generate in one shot. Python state is injected with ${value}, updated from JavaScript through props.value, and synced back with trigger('change'). Subclassing gr.HTML turns such a component into a reusable one that works like gr.Image or gr.Slider. Examples include a Pomodoro timer, a Kanban board with native HTML5 drag-and-drop, a contribution heatmap, an ML detection viewer, a Three.js camera control and a live speech transcription display, all deployable to Hugging Face Spaces without a build step.

  • Introducing Daggr: Chain apps programmatically, inspect visually

    Hugging Face mediumAdept

    Daggr is an open-source Python library from the Gradio team for chaining Gradio Spaces, Hugging Face Inference Providers models and custom Python functions into workflows defined in code, with an automatically generated visual canvas. The canvas lets you inspect intermediate outputs, change inputs and rerun individual steps, while state, cached results and multiple "sheets" persist between sessions. Three node types are covered: GradioNode, which can clone and run a Space locally with remote fallback; FnNode; and InferenceNode. A walkthrough builds an image-to-3D pipeline from background removal, downscaling, FLUX.2-klein and TRELLIS.2. The library is in beta, so APIs may change and data loss is possible during updates.

  • Showcase Your Projects in Spaces using Gradio

    Hugging Face mediumAdept

    Gradio's Hugging Face Hub integration lets you build an ML demo from a Hub model ID in a few lines: gr.Interface.load plus a title, description and example inputs, backed by the Inference API. You can host these demos for free on Hugging Face Spaces by adding an app.py, and wrap custom checkpoints in an Interface when the Inference API doesn't support them. Gradio's Series chains models together, shown here as a French story generator built from Opus MT translation models around a GPT-2 story generator.

  • The 5 Most Under-Rated Tools on Hugging Face

    Hugging Face mediumAdept

    Five overlooked Hugging Face Hub features (ZeroGPU, multi-process Docker Spaces, the Gradio API client, Hub webhooks and Nomic Atlas) can be combined into a free, automatically updating semantic search pipeline, demonstrated over a subreddit data source. A scheduled Space pulls Reddit posts into a dataset, a webhook triggers a processing Space, and that Space calls a ZeroGPU-hosted nomic-embed-text-v1.5 model through gradio_client to add embeddings and build an Atlas map. Practical details include the @spaces.GPU decorator, supervisord config for running a worker and a log viewer in one container, and webhook handling: respond within 30s using background tasks, and filter by repo scope, main branch and changed files.

The quest for software engineering knowledge.

Look:
Layout: