Hi there,
I am a student in data science, and I don’t understand why we would use a framework like Flask ou FastAPI without any UI when we can use Streamlit with a beautiful and simple UI ? Are they two things totally different ?
When I want to show a final user how to use a model I use only streamlit, I don’t even know how to use Flask…
The short answer is, they are all different projects with different goals
A longer answer might be…
Flask is a barebones web framework, which was a reaction to the “everything included” nature of Django. Not everyone needed a login functionality, a database data model and all the other things that came along with Django’s original use-case (a content-management system if I’m not mistaken, similar in nature to the Wordpress project). So Flask came along and let you start with the absolute minimum you needed to serve different pages/endpoints (i.e. different urls), and then you can add in a database piece or whatever else you wanted.
FastAPI is a reimagining of Flask in some ways, recognizing that for people who only want to create an API (but not serve web pages), that perhaps there’s a more efficient way of creating APIs with a purpose-built package. So FastAPI aims to be performance-faster, easier to code for the API use case faster, implements API-specific things such as OpenAPI and JSON schemas, etc.
Then there’s Streamlit. Streamlit, in its current state, only allows for a single-url style app. You cannot make API requests (i.e. GET/POST/PUT, etc.) like you can with Flask or Fast API, and the focus tends to be around data apps instead of computers talking to other computers like API use-cases generally are. But because Streamlit is focusing on the data app use case, it comes with a lot of conveniences for human interaction with the app without all the extra/difficult functionality of Django/Flask/Fast API.
Of course, as each project continues over time, people figure out new and interesting ways to use them. So in one sense, lots of projects tend to converge towards what people want to do vs. being completely separate functionalities. But that’s one of the best parts of open-source, that besides being monetary free, you are free to pick and choose which package(s) give you the best solution for your specific use.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.