Skip to content

ncassereau/gradio_rag_sources

Repository files navigation

tags title short_description colorFrom colorTo sdk pinned app_file
gradio-custom-component
gradio_rag_sources
A Gradio custom component to display RAG sources
blue
yellow
gradio
false
space.py

gradio_rag_sources

PyPI - Version Static Badge

A Gradio custom component to display RAG sources

Installation

pip install gradio_rag_sources

Usage

import gradio as gr

from gradio_rag_sources import RagSourcesTable
from gradio_rag_sources import _RagSource as RagSource


with gr.Blocks() as demo:
    sources = [
        RagSource(
            url="https://www.idris.fr",
            retrievalScore=0.45,
            rerankScore=0.9,
        ),
        RagSource(
            url="https://www.google.fr",
            retrievalScore=0.45,
            rerankScore=0.95,
        ),
        RagSource(
            url="https://www.pytorch.org",
            retrievalScore=0.55,
            rerankScore=0.8,
        ),
    ]
    RagSourcesTable(value=sources)


if __name__ == "__main__":
    demo.launch()

RagSourcesTable

Initialization

name type default description
value
Any
None None
label
str | None
None None
info
str | None
None None
show_label
bool | None
None None
container
bool
True None
scale
int | None
None None
min_width
int | None
None None
interactive
bool | None
None None
visible
bool
True None
elem_id
str | None
None None
elem_classes
list[str] | str | None
None None
render
bool
True None
key
int | str | None
None None
load_fn
Callable | None
None None
every
Timer | float | None
None None
inputs
Component | Sequence[Component] | set[Component] | None
None None

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published