LOCKIntegration

Gradio + Meridian chat interface

Embed Meridian's inference engine inside a Gradio Blocks app using the OpenAI-compatible client. One gr.ChatInterface call, zero boilerplate.

app.py
import gradio as gr
from openai import OpenAI

client = OpenAI(
    base_url="https://api.meridian.sh/v1",
    api_key="mrdn_sk_..."
)

def predict(message, history):
    msgs = [{"role": "system", "content": "You are Meridian."}]
    for h in history:
        msgs.append({"role": "user", "content": h[0]})
        msgs.append({"role": "assistant", "content": h[1]})
    msgs.append({"role": "user", "content": message})

    stream = client.chat.completions.create(
        model="meridian-4",
        messages=msgs,
        stream=True,
    )
    partial = ""
    for chunk in stream:
        if chunk.choices[0].delta.content:
            partial += chunk.choices[0].delta.content
            yield partial

demo = gr.ChatInterface(
    fn=predict,
    title="Meridian Chat",
    description="Powered by Meridian API",
)
demo.launch()
  1. 1Install gradio and openai via pip.
  2. 2Set base_url to your Meridian endpoint and paste your API key.
  3. 3Wrap the streaming predict function in gr.ChatInterface and call .launch().
Meridian © 2026 — Enterprise inference infrastructure