A newer version of the Gradio SDK is available:
5.12.0
title: Gradio Example Template
emoji: π¬
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false
license: mit
short_description: Example on using Langfuse to trace Gradio applications.
Build a LLM Chat UI with π€ Gradio and trace it with πͺ’ Langfuse
This is a Gradio example template that showcases how to integrate a Gradio application with Langfuse for LLM Observability and Evaluation. Check out this cookbook for a step-by-step explanation of the code.
What is Langfuse?
Langfuse is an open-source LLM engineering platform that helps build reliable LLM applications via LLM Application Observability, Evaluation, Experiments, and Prompt Management.
Langfuse can either be self-hosted, used via the Langfuse Cloud or deplyoed on Hugging Face Spaces. The Langfuse Hugging Face Space allows you to get up and running with a deployed version of Langfuse with just a few clicks. Within a few minutes, you'll have this default Langfuse dashboard deployed and ready for you to connect to from your local machine.
What is Gradio?
Gradio is an open-source Python library that enables quick creation of web interfaces in Hugging Face for machine learning models, APIs, and Python functions. It allows developers to wrap any Python function with an interactive UI that can be easily shared or embedded, making it ideal for demos, prototypes, and ML model deployment. See docs for more details.
Features of this Template
This template will show you how to
- Build a simple chat interface in Python and rendering it using Gradio
Chatbot
- Add Langfuse Tracing to the chatbot
- Implement additional Langfuse tracing features used frequently in chat applications: chat sessions, user feedback
Troubleshooting
- Make sure your notebook runs locally in app mode using
python app.py
- Check that all required packages are listed in
requirements.txt
- Check Space logs for any Python errors
For more help, open a support thread on GitHub discussions or open an issue.
π Thank you to @tkmamidi for the original implementation and contributions to this notebook.