cog
cog copied to clipboard
Integrated Gradio Demo App
Description: The COG project is an incredible tool that simplifies the process of deploying machine learning models by just writing a handler. It enables users to get a complete working service with ease. However, during the development and testing stages, it would be extremely beneficial to have an integrated Gradio demo app. This will provide an interactive user interface that allows users to easily interact and test the model without the need for using CURL, Postman, or programming languages.
Feature Details:
- The integrated Gradio demo app should be accessible at the
/demo
endpoint. - Users can interact with the model using the Gradio interface, providing input and viewing the model's output in real-time.
- The Gradio demo app should automatically generate the appropriate input components based on the model's input types (e.g., string, integer, float, boolean, file, path) and utilize the Pydantic model's additional information for description, default values, minimum, maximum, and choices, when available.
- The Gradio integration should be optional, allowing users to enable or disable it based on their use-case. This will enable developers to use the interactive demo during development and prototyping and easily disable it for production deployment.
Benefits:
- Eases the testing and interaction with the model during development and prototyping stages.
- Provides a user-friendly interface for non-technical stakeholders to interact with the model and understand its capabilities.
- Improves user experience by eliminating the need for external tools (e.g., CURL, Postman) or custom code for testing the model.
Implementation Approach:
- Utilize Gradio's Python library to create the interactive demo app.
- Mount the Gradio demo app within the FastAPI webapp.
- Leverage the existing Pydantic model information to generate appropriate input components and descriptions.
This feature will further enhance the usability and user experience of the COG project, making it an even more valuable tool for deploying machine learning models.
I am willing to take on this feature request as it presents an excellent opportunity for learning and growth.
### Tasks
This sounds very interesting! This would even make something like DragGAN works more easily on Replicate 😄
W.r.t. the details, I'm wondering how you could mount a Gradio app into a FastAPI app?
Gradio has built-in support for mounting to FastAPI app. Refer this doc.
Great!
I also found that HF has a feature that would turn Gradio app into a REST API endpoint: https://huggingface.co/spaces/tomsoderlund/rest-api-with-gradio
See this awesome demo: https://www.youtube.com/watch?v=mbn6yLcoyzo
This might be something interesting to look at and build on Replicate too!
Maybe check this out: https://github.com/multimodalart/grog