This project provides a web-based interface for interacting with machine learning models served on Databricks, featuring functionalities to register new Hugging Face models, chat with these models, and view chat history. Built with Dash and leveraging Databricks for model serving, it offers a user-friendly platform for experimenting with and deploying machine learning models.
- Model Registration: Easily register new Hugging Face models with Databricks and create serving endpoints directly from the interface.
- Chat Interface: Engage in conversations with the registered models served on Databricks, providing a seamless chatting experience.
- Chat History: View the history of your interactions with the models, allowing for review and analysis of past conversations.
In order to run this app, you will need to make sure you have the following items:
- Python 3.10 or later
- Databricks account
- Hugging Face models (for registration)
Databricks-specific items:
- A Databricks workspace with Unity Catalog enabled This workspace is where you'll be pulling models from Hugging Face, logging them, and deploying them. It's essential that your account has the permissions needed to create clusters, jobs, and manage models.
- A personal access token to authenticate with Databricks SDK workspace client
- A Python development environment running Python3.10 Having a functional development environment for Plotly Dash is crucial. Dash is a Python framework for building data applications. Follow the instructions in this project’s README.md file on Github (link) in order to deploy this project’s Dash app. If you are looking for a quickstart guide to Dash, check out our Dash in 20 minutes tutorial here.
*** In addition, the user whose personal access token you choose to use must have CREATE MODEL permissions enabled. (see below) ***
- Clone the repository to your local machine:
git clone https://github.com/yourgithubusername/yourrepositoryname.git
- Navigate to the cloned directory:
cd dashdbxhf
- Install the required Python dependencies:
pip install -r requirements.txt
- Set up your environment variables by creating a
.env
file in the root directory and adding your Databricks token and host:
DATABRICKS_TOKEN=your_databricks_token
DATABRICKS_HOST=https://your-databricks-workspace-url
- Start the Dash application:
python app.py
- Open a web browser and navigate to
http://localhost:8050/
to access the application.
- Navigate to the "Register New Models" tab.
- Fill in the form with the Hugging Face model name, a registered name for your model, maximum tokens for inference, and the default temperature.
- Click "Register Model with Databricks and Create Serving Endpoint" to complete the registration.
- Go to the "Chat Interface" tab.
- Select a model from the "Select Endpoint" dropdown.
- Enter your message in the text area and click "Submit Text" to send.
- The model's response will appear in the chat interface.
- Switch to the "Chat History" tab to view the history of your conversations.
Contributions to improve the project are welcome. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.
Distributed under the MIT License. See LICENSE
for more information.
Sachin- sachin@plot.ly