I made an URL shortener in python
I saw the idea on a list of project and thought it was interesting.
It uses flask to handle the redirects and pickle to save short urls.
Here is the repo.
Interested to see what you think!
/r/Python
https://redd.it/10fhivs
I saw the idea on a list of project and thought it was interesting.
It uses flask to handle the redirects and pickle to save short urls.
Here is the repo.
Interested to see what you think!
/r/Python
https://redd.it/10fhivs
GitHub
GitHub - Krizsan0596/PyShortener: Simple URL shortener written in Python
Simple URL shortener written in Python. Contribute to Krizsan0596/PyShortener development by creating an account on GitHub.
Instagram bot generates images using Stable Diffusion Webui
So I've written an Instagram bot in python that gets a prompt from an Instagram message then responds with the image it generated from that prompt.
If you want to check the bot out, its tag is @lajosabot. I'll probably bring him online sometime soon.
Here is the source code: https://github.com/Krizsan0596/InstaDiffusion
I'm interested to see what you think!
/r/Python
https://redd.it/10fhd44
So I've written an Instagram bot in python that gets a prompt from an Instagram message then responds with the image it generated from that prompt.
If you want to check the bot out, its tag is @lajosabot. I'll probably bring him online sometime soon.
Here is the source code: https://github.com/Krizsan0596/InstaDiffusion
I'm interested to see what you think!
/r/Python
https://redd.it/10fhd44
GitHub
GitHub - Krizsan0596/InstaDiffusion: Instagram bot to generate images using stablediffusion
Instagram bot to generate images using stablediffusion - GitHub - Krizsan0596/InstaDiffusion: Instagram bot to generate images using stablediffusion
DocArray v2: Nicely represent multi-modal data in your ML models
Hey y'all!
A while ago we **announced DocArray v2** here on r/Python, a project for representing, sending and storing multi-modal data, and we were super happy about the positive feedback!
Today we're just giving a quick update on the new alpha version that we have released since then.
Then main focus of this release is making DocArray play nice with ML model training and serving.
DocumentArray's now offer a stacked mode, in which all tensors in said array are, well, stacked! This makes it directly usable as a data batch in a PyTorch model:
from docarray import Document, DocumentArray
from docarray.typing import TorchTensor, ImageUrl
from typing import Optional
class MyImage(BaseDocument):
tensor: TorchTensor3, 224, 224
url: ImageUrl
embedding: TorchEmbedding768
doc = MyImage(...)
da = DocumentArrayMyImage.stack()
t = da.tensor # returns a big stacked image tensor (batch)
/r/Python
https://redd.it/10f8bms
Hey y'all!
A while ago we **announced DocArray v2** here on r/Python, a project for representing, sending and storing multi-modal data, and we were super happy about the positive feedback!
Today we're just giving a quick update on the new alpha version that we have released since then.
Then main focus of this release is making DocArray play nice with ML model training and serving.
DocumentArray's now offer a stacked mode, in which all tensors in said array are, well, stacked! This makes it directly usable as a data batch in a PyTorch model:
from docarray import Document, DocumentArray
from docarray.typing import TorchTensor, ImageUrl
from typing import Optional
class MyImage(BaseDocument):
tensor: TorchTensor3, 224, 224
url: ImageUrl
embedding: TorchEmbedding768
doc = MyImage(...)
da = DocumentArrayMyImage.stack()
t = da.tensor # returns a big stacked image tensor (batch)
/r/Python
https://redd.it/10f8bms
Reddit
r/Python on Reddit: Announcing DocArray v2
Posted by u/TeamDocArray - 43 votes and 4 comments
I think I found a bug in subprocess and created a test case, whats the best way to let the python development team know?
Subprocess can take in an input stream, except when that input stream is a Spooled Temp file, in which case that fails.
Here's an example:
https://github.com/zackees/python-subprocess-bug-spooled-temp-file
How can I let the pydevs know?
/r/Python
https://redd.it/10fbw6t
Subprocess can take in an input stream, except when that input stream is a Spooled Temp file, in which case that fails.
Here's an example:
https://github.com/zackees/python-subprocess-bug-spooled-temp-file
How can I let the pydevs know?
/r/Python
https://redd.it/10fbw6t
GitHub
GitHub - zackees/python-subprocess-bug-spooled-temp-file
Contribute to zackees/python-subprocess-bug-spooled-temp-file development by creating an account on GitHub.
CS50 during PhD in Earth Sciences? advices gratefully appreciated :)
Hi everyone!
I'm a geologist (hydrogeologist) who started my PhD in the discipline of earth and environmental sciences in October 2022.
About two months ago, after listening to a webinar on the use of Python in GIS and hydrogeology, I started learning this language out of sheer curiosity - I had never been exposed to programming before really.
A few days ago I managed to finish my first mini-project, if that's what I can call it, which allows me to download multiple sets of data simultaneously from the website of a river monitoring unit, in addition, my program allows me to combine multiple CSV files into one and filter them and present the data in plots much faster than, for example, I would have to do it in Excel. Which is awesome!!!
Long story short, it seems to me that programming can strongly help me during my four years of doctoral studies and expand my CV. One of the main goals of my research is to build an HEC-RAS model that would be used to perform a risk assessment of water intake. As you can probably guess, a very important part of this type of work is the collection and processing of large data
/r/Python
https://redd.it/10fi6wq
Hi everyone!
I'm a geologist (hydrogeologist) who started my PhD in the discipline of earth and environmental sciences in October 2022.
About two months ago, after listening to a webinar on the use of Python in GIS and hydrogeology, I started learning this language out of sheer curiosity - I had never been exposed to programming before really.
A few days ago I managed to finish my first mini-project, if that's what I can call it, which allows me to download multiple sets of data simultaneously from the website of a river monitoring unit, in addition, my program allows me to combine multiple CSV files into one and filter them and present the data in plots much faster than, for example, I would have to do it in Excel. Which is awesome!!!
Long story short, it seems to me that programming can strongly help me during my four years of doctoral studies and expand my CV. One of the main goals of my research is to build an HEC-RAS model that would be used to perform a risk assessment of water intake. As you can probably guess, a very important part of this type of work is the collection and processing of large data
/r/Python
https://redd.it/10fi6wq
reddit
CS50 during PhD in Earth Sciences? advices gratefully appreciated :)
Hi everyone! I'm a geologist (hydrogeologist) who started my PhD in the discipline of earth and environmental sciences in October 2022. About...
Django Querying Mastery: Only in 6 Min Read
Unlock the full potential of your Django databases with this comprehensive guide on how to master the art of querying. From filtering data to fetching it in a specific format, this tutorial covers it all. Dive deep into advanced querying techniques such as using Q objects, annotations, aggregations, exclusions, and sorting. Learn how to perform annotation on filters and aggregation on annotations, as well as filtering on annotations. This guide has been crafted after extensive research on the official documentation, source code, and real-world use cases to bring you the most essential and commonly used queries. Whether you're a beginner or an experienced developer, this tutorial is sure to take your Django querying skills to the next level. Django ORM Examples and Exercises
/r/djangolearning
https://redd.it/10eu0mt
Unlock the full potential of your Django databases with this comprehensive guide on how to master the art of querying. From filtering data to fetching it in a specific format, this tutorial covers it all. Dive deep into advanced querying techniques such as using Q objects, annotations, aggregations, exclusions, and sorting. Learn how to perform annotation on filters and aggregation on annotations, as well as filtering on annotations. This guide has been crafted after extensive research on the official documentation, source code, and real-world use cases to bring you the most essential and commonly used queries. Whether you're a beginner or an experienced developer, this tutorial is sure to take your Django querying skills to the next level. Django ORM Examples and Exercises
/r/djangolearning
https://redd.it/10eu0mt
Medium
Django ORM — Examples and Practice Problems
Welcome to Django ORM practice. This article will provide you problems and solutions based on dataset to help you practice Django ORM and…
SessionId inside the cookie header slows down request
Hi,
I'm learning how to use django sessions and caching.
I noticed that once I login, a sessionId is included in the cookie header. I'm using the "@authentication_classes" and "@permission_classes" decorators to validate the session.
I'm also using Redis to cache the session, since I dont want to hit the DB everytime. I followed the docs for the django and redis server setup.
Once the user log in, the session is written in the cache. The problem is that, even tho the session is inside the cache, the database is hit with each request and it slows down the response time to around 300ms.
This is the api I'm using for testing. It does nothing, but it takes 300 ms and it does hit the DB each time I call it. I'm using "never_cache" because I dont want the entire response to be cached.
@apiview(["GET"])
@authenticationclasses (SessionAuthentication)
@permissionclasses([IsAuthenticated])
@nevercache
def test(request, username):
return JsonResponse("", safe=False)
this is the request I'm making:
https://preview.redd.it/hs6o0thwlsca1.png?width=1018&format=png&auto=webp&v=enabled&s=b6955519bd8e58e8cbc5fd580ff7c15c877c5a90
If I remove the session autentication decorators, a SessionId is not required anymore to
/r/djangolearning
https://redd.it/10f699i
Hi,
I'm learning how to use django sessions and caching.
I noticed that once I login, a sessionId is included in the cookie header. I'm using the "@authentication_classes" and "@permission_classes" decorators to validate the session.
I'm also using Redis to cache the session, since I dont want to hit the DB everytime. I followed the docs for the django and redis server setup.
Once the user log in, the session is written in the cache. The problem is that, even tho the session is inside the cache, the database is hit with each request and it slows down the response time to around 300ms.
This is the api I'm using for testing. It does nothing, but it takes 300 ms and it does hit the DB each time I call it. I'm using "never_cache" because I dont want the entire response to be cached.
@apiview(["GET"])
@authenticationclasses (SessionAuthentication)
@permissionclasses([IsAuthenticated])
@nevercache
def test(request, username):
return JsonResponse("", safe=False)
this is the request I'm making:
https://preview.redd.it/hs6o0thwlsca1.png?width=1018&format=png&auto=webp&v=enabled&s=b6955519bd8e58e8cbc5fd580ff7c15c877c5a90
If I remove the session autentication decorators, a SessionId is not required anymore to
/r/djangolearning
https://redd.it/10f699i
how to loop through options in a for loop via With and Includes
i am using With and includes
{% with "'apple', 'pear', 'banana'" as fruit %}
{% include 'includes/contact-form/options/fruit.html' %}
{% endwith %}
and in my includes i have
<ul>
{% for item in fruit %}
<li>{{ item }}</li>
{% endfor %}
</ul>
but its printing out each letter, per li tag!i can't do any model/view edits, so it has to be within this 'with' thing!
/r/djangolearning
https://redd.it/10dma61
i am using With and includes
{% with "'apple', 'pear', 'banana'" as fruit %}
{% include 'includes/contact-form/options/fruit.html' %}
{% endwith %}
and in my includes i have
<ul>
{% for item in fruit %}
<li>{{ item }}</li>
{% endfor %}
</ul>
but its printing out each letter, per li tag!i can't do any model/view edits, so it has to be within this 'with' thing!
/r/djangolearning
https://redd.it/10dma61
reddit
how to loop through options in a for loop via With and Includes
i am using With and includes {% with "['apple', 'pear', 'banana']" as fruit %} {% include 'includes/contact-form/options/fruit.html' %}...
How to keep your requirements.txt updated
https://www.rockandnull.com/python-update-requirements-txt/
/r/djangolearning
https://redd.it/10cs4z2
https://www.rockandnull.com/python-update-requirements-txt/
/r/djangolearning
https://redd.it/10cs4z2
Rock and Null
How to keep your requirements.txt updated
Over the app's lifetime, those libraries you decided to use must remain updated to ensure that the web app is working properly and securely.
GPT-4 Will Be 500x Smaller Than People Think - Here Is Why
​
Number Of Parameters GPT-3 vs. GPT-4
The rumor mill is buzzing around the release of GPT-4.
People are predicting the model will have 100 trillion parameters. That’s a trillion with a “t”.
The often-used graphic above makes GPT-3 look like a cute little breadcrumb that is about to have a live-ending encounter with a bowling ball.
Sure, OpenAI’s new brainchild will certainly be mind-bending and language models have been getting bigger — fast!
But this time might be different and it makes for a good opportunity to look at the research on scaling large language models (LLMs).
Let’s go!
Training 100 Trillion Parameters
The creation of GPT-3 was a marvelous feat of engineering. The training was done on 1024 GPUs, took 34 days, and cost $4.6M in compute alone [1\].
Training a 100T parameter model on the same data, using 10000 GPUs, would take 53 Years. To avoid overfitting such a huge model the dataset would also need to be much(!) larger.
So, where is this rumor coming from?
The Source Of The Rumor:
It turns out OpenAI itself might be the source of it.
In August 2021 the CEO of Cerebras told wired: “From talking to OpenAI, GPT-4 will be about 100 trillion parameters”.
A the time, that was most likely what they
/r/Python
https://redd.it/10fw3a5
​
Number Of Parameters GPT-3 vs. GPT-4
The rumor mill is buzzing around the release of GPT-4.
People are predicting the model will have 100 trillion parameters. That’s a trillion with a “t”.
The often-used graphic above makes GPT-3 look like a cute little breadcrumb that is about to have a live-ending encounter with a bowling ball.
Sure, OpenAI’s new brainchild will certainly be mind-bending and language models have been getting bigger — fast!
But this time might be different and it makes for a good opportunity to look at the research on scaling large language models (LLMs).
Let’s go!
Training 100 Trillion Parameters
The creation of GPT-3 was a marvelous feat of engineering. The training was done on 1024 GPUs, took 34 days, and cost $4.6M in compute alone [1\].
Training a 100T parameter model on the same data, using 10000 GPUs, would take 53 Years. To avoid overfitting such a huge model the dataset would also need to be much(!) larger.
So, where is this rumor coming from?
The Source Of The Rumor:
It turns out OpenAI itself might be the source of it.
In August 2021 the CEO of Cerebras told wired: “From talking to OpenAI, GPT-4 will be about 100 trillion parameters”.
A the time, that was most likely what they
/r/Python
https://redd.it/10fw3a5
Course that can help you with the deployment part of things
Hello everyone,
I've created a course that I think might be of use to some of you who are interested in the deployment part of things.
It's a DevOps course and it has a section where I dockerize a Python application,
create a CI/CD pipeline in GitLab, and then run the program on the VPS via GitLab Runner.
Here's the link to 100% OFF coupon (1000 of those):
https://www.udemy.com/course/real-world-devops-project-from-start-to-finish/?couponCode=FREEDEVOPS2301DJF8A
There's around 30 minutes you can watch before enrolling to decide if it's for you or not.
If it doesn't appeal to you, please leave it for the next guy.
Happy learning,
Predrag
/r/Python
https://redd.it/10fw95c
Hello everyone,
I've created a course that I think might be of use to some of you who are interested in the deployment part of things.
It's a DevOps course and it has a section where I dockerize a Python application,
create a CI/CD pipeline in GitLab, and then run the program on the VPS via GitLab Runner.
Here's the link to 100% OFF coupon (1000 of those):
https://www.udemy.com/course/real-world-devops-project-from-start-to-finish/?couponCode=FREEDEVOPS2301DJF8A
There's around 30 minutes you can watch before enrolling to decide if it's for you or not.
If it doesn't appeal to you, please leave it for the next guy.
Happy learning,
Predrag
/r/Python
https://redd.it/10fw95c
Udemy
Real world DevOps project from start to finish [02/2023]
For startups, individuals, and self-hosting | Docker, LXC, GitLab, CI/CD, Ansible, certbot, WireGuard, Traefik, Pi-hole
What's the best advanced project 8 can write
Hello guys. Senior dev here.
I want to start working on a new python project to add to my portfolio.
The main motivation of this project will be to demonstrate super solid knowledge and skills.
I'm ok with it taking time if it's a big one.
I'm ok with writing a vanilla oop app if it demonstrate my knowledge better.
I'm comfortable with web / IoT devices / network communication.
I wrote some complex frontend apps with frontend frameworks etc.
Comfortable with docker containers.
I just want to write something that whenever a dev interviewer sees it his response will be "I want that dude on my team".
Please help me find the perfect project!
/r/Python
https://redd.it/10fxu0a
Hello guys. Senior dev here.
I want to start working on a new python project to add to my portfolio.
The main motivation of this project will be to demonstrate super solid knowledge and skills.
I'm ok with it taking time if it's a big one.
I'm ok with writing a vanilla oop app if it demonstrate my knowledge better.
I'm comfortable with web / IoT devices / network communication.
I wrote some complex frontend apps with frontend frameworks etc.
Comfortable with docker containers.
I just want to write something that whenever a dev interviewer sees it his response will be "I want that dude on my team".
Please help me find the perfect project!
/r/Python
https://redd.it/10fxu0a
reddit
What's the best advanced project 8 can write
Hello guys. Senior dev here. I want to start working on a new python project to add to my portfolio. The main motivation of this project will...
pyCANON: A Python library to check the level of anonymity of a dataset
https://pycanon.readthedocs.io/en/latest/index.html
/r/Python
https://redd.it/10fxtf4
https://pycanon.readthedocs.io/en/latest/index.html
/r/Python
https://redd.it/10fxtf4
reddit
pyCANON: A Python library to check the level of anonymity of a dataset
Posted in r/Python by u/pmz • 2 points and 0 comments
Cnverting a Liststring into a Listlist...
Hello everyone, first post ever... can someone point me in the right direccion? I need to format the firt list into the same format as the second one. Python
print(incorrentformatlist)
'AsKh', '2sAc', '7hQs',...........
print(correctformatlist)
['As', 'Kh', '2s', 'Ac', '7h', 'Qs',..............]
\#I tried:
for h in incorrect_format_list:
split_lines = h.split(", ")
\#but the print output is this:
'AsKh'
'2sKh'
'7hQs'
... #rather than what i need: ['As', 'Kh', '2s', 'Ac', '7h', 'Qs'..............]
/r/Python
https://redd.it/10fvovh
Hello everyone, first post ever... can someone point me in the right direccion? I need to format the firt list into the same format as the second one. Python
print(incorrentformatlist)
'AsKh', '2sAc', '7hQs',...........
print(correctformatlist)
['As', 'Kh', '2s', 'Ac', '7h', 'Qs',..............]
\#I tried:
for h in incorrect_format_list:
split_lines = h.split(", ")
\#but the print output is this:
'AsKh'
'2sKh'
'7hQs'
... #rather than what i need: ['As', 'Kh', '2s', 'Ac', '7h', 'Qs'..............]
/r/Python
https://redd.it/10fvovh
reddit
Cnverting a List[string] into a List[list]...
Hello everyone, first post ever... can someone point me in the right direccion? I need to format the firt list into the same format as the second...
How to host flask alongside a Wordpress site?
I have a wordpress site hosted mycoolsite.com Now I have developed a small web app that I want to be associated with this site. How do I add it to app.mycoolsite.com or mycoolsite.com/app? The site is hosted on namecheap shared hosting.
/r/flask
https://redd.it/10bpf1j
I have a wordpress site hosted mycoolsite.com Now I have developed a small web app that I want to be associated with this site. How do I add it to app.mycoolsite.com or mycoolsite.com/app? The site is hosted on namecheap shared hosting.
/r/flask
https://redd.it/10bpf1j
Why do we need models? Why can't we just use views with custom functionality?
Might be a dumb question, but I'm working on a django project right now and had this question. In my case - we're making a new app that takes in a CSV and does some analysis, etc. as part of a larger django project. My question - why do I need to make a new django model at all? Why can't I just make a new view in the older app, make a button, and do some backend code to store / analyze the CSV?
Am I missing something conceptual here about how models work / why they're used? Or is this more of a convention thing (i.e. my idea also works but it's better to separate stuff into models)?
/r/django
https://redd.it/10g4p3w
Might be a dumb question, but I'm working on a django project right now and had this question. In my case - we're making a new app that takes in a CSV and does some analysis, etc. as part of a larger django project. My question - why do I need to make a new django model at all? Why can't I just make a new view in the older app, make a button, and do some backend code to store / analyze the CSV?
Am I missing something conceptual here about how models work / why they're used? Or is this more of a convention thing (i.e. my idea also works but it's better to separate stuff into models)?
/r/django
https://redd.it/10g4p3w
reddit
Why do we need models? Why can't we just use views with custom...
Might be a dumb question, but I'm working on a django project right now and had this question. In my case - we're making a new app that takes in a...
New Django Rocket release 0.3.0
https://github.com/ErnestoFGonzalez/djangorocket/releases/tag/0.3.0
/r/django
https://redd.it/10g4sdb
https://github.com/ErnestoFGonzalez/djangorocket/releases/tag/0.3.0
/r/django
https://redd.it/10g4sdb
GitHub
Release 0.3.0 · ErnestoFGonzalez/djangorocket
Added a docker-compose.yml file to set up Postgres and Redis instances. (#23)
Changed index template to add links to documentation and source code. (#23)
Changed index template to add links to documentation and source code. (#23)
Logging errors when debug is off on Heroku
I have an flask app I'm close to deploying on Heroku and am a bit confused about logging errors once debug mode is off.
I know you need to turn debug mode off for a production environment but of course that means I won't get those great error messages telling me what went wrong.
I looked into a few logging add-ons available on Heroku but am a bit lost on how I can make sure that useful error messages will be logged so I can find issues without being in debug mode.
Please share any suggestions on how I can acheive my goal of protecting my app and still being able to figure out what went wrong (of course something will go wrong!) in my app on an ongoing basis.
/r/flask
https://redd.it/10g6802
I have an flask app I'm close to deploying on Heroku and am a bit confused about logging errors once debug mode is off.
I know you need to turn debug mode off for a production environment but of course that means I won't get those great error messages telling me what went wrong.
I looked into a few logging add-ons available on Heroku but am a bit lost on how I can make sure that useful error messages will be logged so I can find issues without being in debug mode.
Please share any suggestions on how I can acheive my goal of protecting my app and still being able to figure out what went wrong (of course something will go wrong!) in my app on an ongoing basis.
/r/flask
https://redd.it/10g6802
reddit
Logging errors when debug is off on Heroku
I have an flask app I'm close to deploying on Heroku and am a bit confused about logging errors once debug mode is off. I know you need to turn...