Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
D Is anyone else having trouble with the unstructured output from language models? 😩

I found a way to fix this and wrote the process with code in this article but if anyone knows of a better way, I'd love to know!

Basically used Pydantic output parsers to turn messy LLM responses into clean, structured data that's easy to use in our applications. The process was build a model that suggests data visualization charts from a tabular dataset, organized the output, and made it ready for easy API calls and frontend use.

/r/MachineLearning
https://redd.it/1dyxiw4
A website of free web tools.

Hi friends, me and my friend made a website in flask with free web tools like an image converter, an image resizer as well as other tools like a currency converter etc..



I wanted to present it to you because we've worked hard on it and I'm looking for ideas for new tools to develop for the site!

> Here our website !


I've been using flask for a few years now and it's so good.

I do self hosting with a machine at home and use cloudflare to hide my DNS and ip address. My website work with Waitress as production server, i want to try gunicorn soon but i need to learn linux and it's not easy for me who use Windows server for more then 10 years xd

/r/flask
https://redd.it/1dzbzqb
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1dzhlys
Anyone moved to Django?

If you moved to Django from other frameworks like (Asp.net, laravel, nodejs, etc) share your experience. And why you found Django to be better.

/r/django
https://redd.it/1dzce7g
I wrote a quit smoking tracker website in Flask

**What My Project Does**

This is a quit smoking tracker website intended for people quitting smoking to be able to track their progress and see health and money milestones to motivate them to stay quit.

**Target Audience (e.g., Is it meant for production, just a toy project, etc.**

It's just a toy project that I wrote in a night, but I'm hoping it can be useful for smokers to stay motivated to quit.

**Comparison (A brief comparison explaining how it differs from existing alternatives.)**

The main difference between this and other stop smoking apps is that this is a website. I haven't been able to find any websites that were similar to the stop smoking apps you can get for your phone, which is partly what motivated me to write this.

Site: https://jimmyrustles.pythonanywhere.com/quitsmoking

Source: https://github.com/sgriffin53/quitsmoking_app

This is a screenshot of what the site would look like for someone who's been quit for 6 months: https://i.imgur.com/8ayu0yu.png

You enter your name, quit date, and how much you spend on smoking per day, and it creates a page that you can come back to.

As you can see, you unlock health benefits and "things you can buy" with your saved money the longer you stay quit.

The things you can buy is based

/r/Python
https://redd.it/1dzij6s
I made (or attempted to make) a better web interface for creating and sharing flashcards than Ankiweb.

It is a prototype of a web interface for Anki that is supposed to be better than ankiweb.net. It may currently be used to create and study basic flashcards, but it is incompatible with Anki files (*.apkg) and lacks many of the features that Anki offers.

I created it as a learning project and to experiment with my really basic idea of sharing and cloning decks using a web interface. I’ll continue to work on it to improve it further, but it isn't meant to be a full-fledged web application.

You can check out and live demo and repo:

Live Demo \- Repo

I’m using Flask for handling all the client requests, validating forms, and handling the database side of things.

However, the one part of the website, which fetches the card from the server for the user to study and then cycles through those cards based on user response, is built in Javascript here, which has been bothering me for some time. Because I believe it would be more interesting to handle it on the backend side. So it will be the next thing I work on.

If you have any suggestions or comments on the project or code, please share.

/r/flask
https://redd.it/1dzl1jj
D RoBERTa From Scratch!

After seeing Karpathy's from scratch GPT model, and a Llama 3 model by u/atronoskronios, I started creating my own "from scratch" implementation of RoBERTa for multiclass classification. In actuality, I did not train the initial weights or implement the attention layer. Rather, I created code to work around those given weights.

In my Github repository, I include a file for the implementation and a separate file for the tokenizer "from scratch" (I didn't have the resources to fully train the tokenizer to RoBERTa standards).

Some code could be unnecessary, but this is what I have got working.

Here is the repository-- thanks: [
https://github.com/nhemauer/Projects/tree/main/RoBERTa%20from%20Scratch](https://github.com/nhemauer/Projects/tree/main/RoBERTa%20from%20Scratch)

This taught me a ton about NLP, and I'd recommend those who have similar interests to check out the Llama 3 from scratch as well: [
https://www.reddit.com/r/MachineLearning/comments/1djyilm/p\llama_3_language_model_implementation_from/](https://www.reddit.com/r/MachineLearning/comments/1djyilm/pllama3languagemodelimplementationfrom/)

/r/MachineLearning
https://redd.it/1dzllu1
Posting - the modern HTTP client that lives in your terminal

Hi Reddit!

I just released version 1 of Posting, an open source TUI HTTP client built using Python and Textual.

# What my project does

Posting is an HTTP client TUI app.

It works over SSH, stores collections locally in a simple (and Git-friendly) YAML format, and can be operated efficiently using both keyboard and mouse.

It aims to push the limits of what you expect from a TUI app in terms of both aesthetics and efficient workflows.

# Target audience

If you work with, test, or develop HTTP APIs, you might find it interesting :)

# Comparison

You can think of Posting as sitting somewhere between Curl and Postman.

Like Curl or HTTPie, it runs in the terminal. This means it works over SSH and you can use it from remote hosts. It's can also be driven efficiently with the keyboard, although you can operate it entirely with the mouse if you wish.

It offers an environment/variables system like Postman, Bruno, and Insomnia. This means you can define variables inside external files, load them into Posting, and then refer to them inside your request.

Similar to some of the GUI tools mentioned, it stores requests in collections. Posting stores them entirely on your local machine in a simple YAML format.

/r/Python
https://redd.it/1dz775b
Photoshop API - Read and Write PSD files with Python and C++


Hey,

Emil Dohne is creating a modern and performant C++20 read/write parser of Photoshop Files (*.psd and *.psb) with fully fledged Python bindings hosted on PyPi, completely on its own.

I just wanted to help him out trying to make his work known, so that more people can utilize this incredibily useful repo and in order to find someone incredibly talented and kind people that wanted to help him out collaborating in the development! At the moment Emil is occupied by another project that he will end by the end of July and he will then be back 100% on this project.

I reckon that the hierarchy of new features needed/really wanted are the following:

1. Support for Smart Object Layers - replacing images inside of the smart object
2. Support for Adjustment Layers
3. Support for Vector Masks
4. Support for Text Layers
5. CMYK, Indexed, Duotone and Greyscale Color Modes

Thank you to whoever even takes the time to read this, let alone whoever shares this project and even more to incredibly smart people that will help Emil out.

Here's some more info about this project: https://github.com/EmilDohne/PhotoshopAPI

# What my Project does

PhotoshopAPI is a C++20 Library with Python bindings for reading and writing of Photoshop Files (*.psd and *.psb) based on

/r/Python
https://redd.it/1dzq8qk
Encountering 400 Bad Request Error on My First Django + React Web App


Hello everyone,

I am currently building my first web application using Django and React, and I've hit a stumbling block. While following a guide by TechWithTim (Django & React Full Stack Web App Tutorial from march 26 - youtube video), I've encountered a persistent 400 Bad Request error during user registration attempts.



Project Repository: You can access the complete code for the project on my GitHub: https://github.com/Drakkarok/DjangoFirstWebApp

Please feel free to fork it, take a look, and contribute any insights you might have.



Issue Description: Each time I try to register a new user through the frontend, the server responds with a 400 Bad Request. This error persists regardless of the input I use.



This is my first attempt at using Django and React (both for me are new), and my experience with JavaScript is quite limited. Therefore, there might be some fundamental misstep that I'm overlooking.



I would greatly appreciate any guidance or suggestions on how to resolve this issue, as it may be something simple that I'm not seeing due to my inexperience.



Thank you very much for your help and patience!

/r/django
https://redd.it/1e0103m