Pickle is over 10 times faster than joblib for save and load scikit-learn models
I was writing an article about different ways to save and load scikit-learn models. There are two approaches to saving and loading the model:
- using pickle
- using joblib
I compared the time of saving/loading of both libraries, and pickle
is over 10 times faster than joblib
. In the case of building some REST API with scikit-learn, choosing the right format for model persistence can bring a huge speed improvement.
The joblib
has a compress
parameter that can produce up to 5 times smaller models than pickle
, but even for small models, joblib
is slower in loading models.
/r/Python
https://redd.it/ypj13g
What is the best language to use for a mobile friendly and non mobile friendly front-end for flask that I can use later on for mobile app development?
If it doesn't make sense to use the same technology for an flask app as a mobile app, then just answer what is good for flask non mobile website and mobile website.
Also can I make a mobile friendly website and non mobile site without to much trouble?
And finally how do I know how the website will it look in mobile ? FYI I don't own a mac.
/r/flask
https://redd.it/ypcxuc
Flask is epic!
Man I love flask! (MILF for short)
I never guessed URL shortener can be made under 40 lines of code, and there we go. :)
​
Keep up the great job, guys!
/r/flask
https://redd.it/ypchsl
D Simple Questions Thread
Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
Thanks to everyone for answering questions in the previous thread!
/r/MachineLearning
https://redd.it/yntyhz
What are some of the django topics that you look for but mostly end up in void?
/r/djangolearning
https://redd.it/yoho15
Start Learning Quantum Computing with IBM Qiskit
https://www.codeandtips.com/qcom/qiskit-demo
/r/Python
https://redd.it/yot8wo
Fill HTML with submit save
I'll leave the full question link here:
https://stackoverflow.com/questions/74349445/post-called-in-another-html-w-django?noredirect=1#comment131257696\_74349445
​
But its basically getting a previous page form that has been saved, a second button that redirects you to second page where the values that were inputted are posted
/r/djangolearning
https://redd.it/yoxzvw
any idea on TypeError: 'NoneType' object is not iterable
I don't know why it is like this.
my django page doesn't work. could you give me any advice?? thank you!
Traceback (most recent call last):
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 220, in _get_response
response = response.render()
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/template/response.py", line 92, in rendered_content
return template.render(context, self._request)
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/template/base.py", line 173, in render
with context.bind_template(self):
File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/home/xxxxyyyy/kkkkk/venv/lib/python3.8/site-packages/django/template/context.py", line 254, in bind_template
updates.update(processor(self.request))
/r/django
https://redd.it/yomw24
Should I make views templates?
I have a website which will have many apps that will have nearly same views in each app with difference in models used and template rendered, should I make templates for the views itself that will be a function that will have models used and templates used as arguments and do the logic then return render template or whatever. This will speed up the development time of each app.
Is this a good idea?
/r/django
https://redd.it/yodvzf
Help planning data integration for a Flask app using an external API and Plotly visualizations
Hello,
I just started building a Flask-based web app that will utilize financial/stock data I will pull from an external API and display it on a web page. I'm trying to keep thing basic as this will be my first real application I've built. I mostly just want to be able to select any available stock ticker (i.e. MSFT, AMZN etc.) and display a graph using the data retrieved from the external API.
I've done similar work where I've pulled data from an external API, stored it in a SQL DB, and connected my database to a visualization tool like Power BI. However, I have limited understanding of how to actually code the backend of an application accessing data from an API or DB. I do have a pretty decent DevOps background but I'm trying to break into the solutions/capability side of things more.
Could you all assist me in understanding the best way to design this? I don't mind being pointed to some solid documentation or guides. For example, I'm not sure when it's more appropriate for an application to query a database directly, make a request directly to the external API, or when I should build my own internal API. While
/r/flask
https://redd.it/yoe013
changing data directly in database breaks the admin?
version: 4.1
databasee: Postgresql 13.2
I have changed some values in boolean column from true
to false
, but the changes didn't reflect in admin dashboard? Inside admin they are still true
.
Why is that?
/r/django
https://redd.it/yo9n7k
Devs who code in both flask and NodeJS which one you prefer ?
I've been using flask as my main framework for about 2 years now but mainly for my freelance and side projects not for my day to day work.
the question is what NodeJS does and flask do better and vice versa.
/r/flask
https://redd.it/ymzwoy
I'm sharing my Django snippets. I hope it'll be helpfull.
https://github.com/4yub1k/django-snippets
/r/django
https://redd.it/ynyoof
Flask vs Django for specific first time web dev project I have in mind?
My university only displays course data that's a year old. For my first full stack/web dev project I wanted to build a website that shows course history of my university going back 10 years or so. I want to allow users to filter by year, department, etc.
I have no web dev experience. I know Python, C++, C#, and a bit of Oracle SQL.
The course data has to be hosted somewhere and in a fashion that supports queries, so wondering whether Flask or Django would support that better.
/r/flask
https://redd.it/ynfh8m
Should I learn Django for my first full stack web dev project?
My university only displays course data that's a year old. For my first full stack/web dev project I wanted to build a website that shows course history of my university going back 10 years or so. I want to allow users to filter by year, department, etc.
I have no web dev experience. I know Python, C++, C#, and a bit of Oracle SQL.
I was wondering if Django would be a good fit for this project.
The course data has to be hosted somewhere and in a fashion that supports queries, so I'm also wondering what the best plan is there.
/r/djangolearning
https://redd.it/ynewki
I updated DictDataBase, it's like SQLite but for JSON, now a lot faster!
Hi guys! You might remember my last post about DictDataBase, and a lot has happened since then!
It is now optimized to operate on bytes instead of strings, so that the UTF-8 encode and decode step can be skipped. This results in a 5x performance gain in many situations. Especially partial reads and writes are blazingly fast now. It now also allows you to select and modify specific json files inside a folder based on a lambda filter function, see the docs for examples!
The project is available on [Github](https://github.com/mkrd/DictDataBase) and [PyPi](https://pypi.org/project/dictdatabase) if you wanna take a look!
These are the main properties of the project:
* **Multi threading and multi processing safe**. Multiple processes on the same machine can simultaneously read and write to dicts without data getting lost.
* **ACID** compliant. Unlike TinyDB, it is suited for concurrent environments.
* **No database server** required. Simply import DictDataBase in your project and use it.
* **Compression**. Configure if the files should be stored as raw json or as json compressed with zlib.
* **Tested** with 100% coverage and over 1000 test cases
/r/Python
https://redd.it/ypgxb9
flask-login not working
Flask redirects back to sign up page with flaskform errors showing specific to the sign up form. It should put these errors on the login page or log the user in.
/r/flask
https://redd.it/ypdrqd
Tuesday Daily Thread: Advanced questions
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/yp5bet
How to save multiple entries into database with a CreateView Class
I'm a Django beginner trying to boost my Django knowledge by creating a resume building application. I'm also trying to see what I can do without having to use JS (to challenge myself). The scenario below is the issue I'm going through.
For example, a user is creating a resume and they are currently entering the schools they attended. The user has attended high school and university and wants to record them both. The user is given 5 inputs that they can fill out, a school name, the address, their start year, graduation year and a description if they want to. However, only those fields are showing up and the user wants to add another school. If the user clicks submit it adds the school to the database and then moves onto the next section of the resume and does not allow them to enter another school.
This is the predicament I am in. I want to be able to give the user the ability to add another school within the same query. So if they entered a high school, they can click "add another school" and more inputs appear for them to enter the university without reloading the page. That way
/r/django
https://redd.it/yp2cdl
how can I connect jupyter notebook backend to react JS frontend?
I'm trying to connect some deep learning jupyter notebook I developed to a react JS frontend but I am not sure how to call it so that the input coming in from the user can replace the hard-coded inputs on the jupyter notebook.
Is there a good converter for jupyter notebook that is more aligned with the traditional python setup? Also, my jupyter notebook references python files in case that matters.
Any help would be greatly appreciated, or any suggestions on helpful resources.
I tried to search online and through forums, but maybe my search style is not effective. Also, I tried to make the jupyter notebook dynamic (to take incoming user input) but it did not work. :(
/r/JupyterNotebooks
https://redd.it/yp0ypk
Attempting to host Django website using CentOS web panel
I have been trying to host a Django based website on CentOS web panel and was wondering if anyone on this subreddit had any prior experience in doing so?
/r/django
https://redd.it/yow34w
November Starlite development updates
Hello, it's your favorite web framework. Starlite.
It's been 2 weeks since we last talked, can you believe it?! Time to catch up!
# Wat?
In case you haven't checked it out yet, Starlite
is an ASGI framework, that aims to be modern, flexible yet opinionated, with all the things
you'd expect like dependency injection, OpenAPI, of course first class support for data validation using
Pydantic and many more.
# About the removal of Starlette
2 weeks ago, it was announced
that Starlite were to drop its dependency on Starlette, it raised some questions about the what and the why.
I think now is a good time to talk about this, since we've made quite the progress in that area,
which I think could be useful to demonstrate the motivation behind it.
## The progress
If you take a look at our tracking issue,
you'll see that most of the dependencies in our code are already gone. A lot of them were
simple static things like status codes, but some were more complex, like the test client.
We are currently nearing the completion of the removal of Starlette, with the remaining dependencies
being addressed in yet-to-be-merged PRs!
## The changes
So what has changed exactly? Some more notable changes include:
- Starlette's Response
has been replaced with
/r/Python
https://redd.it/yoned8
Tired of endlessly scrolling through remote jobs that hire only within certain countries? I made a site to curate fully location independent jobs. It now has around 250 work-from-anywhere job opportunities.
Title.
The above frustration led me to create this site. I hope it helps awesome Python developers on this sub too. Please let me know your feedback.
[edit\]: It has around 1250 jobs. Not 250. Sorry.
https://reddit.com/link/yohul1/video/9v4ngkzb0iy91/player
(If this violates the sub's rules, please let me know, and I'll remove it.)
/r/Python
https://redd.it/yohul1
What are some of the django topics that you look for but mostly end up in void?
/r/django
https://redd.it/yohnjc
Django ORM with Serverless Aurora Data API's
Hi everyone, is there a way to use the serverless Aurora Data API's with Django ORM. I've seen that support for SQL Alchemy exists but couldn't find anything related to Django ORM.
Context: Since my infrastructure is exclusively serverless, every AWS lambda making a connection to the DB traditionally does not seem to be a wise idea to me. Not to mention, it'll also require the lambda's to run in the same VPC as the DB.
Please guide if you've any idea on how to proceed.
/r/django
https://redd.it/yof8yo
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/yo70hn
Should I extend the default user model?
Hi everyone one, I have a simple question, browsing the web I finding many different answers (often with contradiction)
I'm creating a rest API that need to have a model User (that has a lot of different fields compared to the default user of Django)
Should I create a stand-alone (different) model for it or should I extend in some way the one that Django set as default?
/r/django
https://redd.it/yo2w0h
Thoughts on this AWS deployment architecture? (Main web app + lambda microservices)
Hi everyone, I’ve been working on a web app for a while and have been struggling a lot with the deployment side of things on AWS. Basically:
- It handles multiple signals in realtime, so I’m using flask-socketio and thus a single eventlet worker.
- However, It’s also very frequently (multiple times per minute) trying to send files to s3 and google cloud speech-to-text, both of which may be blocking the eventlet worker. The responses are quite slow even for a single user, and my goal is 100 concurrent people
So, this is what I’m thinking on implementing:
- Leaving the main web app with just socketio calls and serving html in EBS
- Making separate lambda functions for s3 file upload and google cloud
What are your thoughts on this? I’d appreciate any other suggestions, especially on scalability. Deploying flask on EBS has frankly been a royal PITA, so I hope moving some stuff to lambda will streamline things
/r/flask
https://redd.it/yndf46
Seeking library recommendation for 3D visualization of crystal structure
Hi, I'm a material scientist and part of my work includes creating crystal structures. I'm looking two write a python script that can visualize the crystal structures I create. So the crystal structure file looks something like this
#line number atom type X-cordinate Y-cordinate Z-cordinate
1 A 0.0 0.0 0.0
2 A 1.0 0.0 0.0
/r/Python
https://redd.it/ynr6xk
flask forms custom validations won't validate email but will on username
/r/flask
https://redd.it/ynm2md