R SEEM: Segment Everything Everywhere All at Once
We introduce SEEM that can Segment Everything Everywhere with Multi-modal prompts all at once. SEEM allows users to easily segment an image using prompts of different types including visual prompts (points, marks, boxes, scribbles and image segments) and language prompts (text and audio), etc. It can also work with any combinations of prompts or generalize to custom prompts!
​
https://preview.redd.it/8pkzou248rta1.png?width=1265&format=png&auto=webp&v=enabled&s=644f4e560f4e1f40a9cbd19f172af1165bae94d0
Play with the demo on GitHub! https://github.com/UX-Decoder/Segment-Everything-Everywhere-All-At-Once
We emphasize 4 important features of SEEM below.
1. Versatility: work with various types of prompts, for example, clicks, boxes, polygons, scribbles, texts, and referring image;
2. Compositionaliy: deal with any compositions of prompts;
3. Interactivity: interact with user in multi-rounds, thanks to the memory prompt of SEEM to store the session history;
4. Semantic awareness: give a semantic label to any predicted mask;
🔥Click, scribble to mask
With a simple click or stoke from the user, we can generate the masks and the corresponding category labels for it.
​
https://preview.redd.it/tymnl8a58rta1.png?width=1732&format=png&auto=webp&v=enabled&s=a2101364cf8b85f9e114f9cae09c1078f38f030b
🔥Text to mask
SEEM can generate the mask with text input from the user, providing multi-modality interaction with human.
​
https://preview.redd.it/jh6h3fb68rta1.png?width=1708&format=png&auto=webp&v=enabled&s=44c628544cf6f19bb4844d2aa8eafdb6e7040fe0
🔥Referring image to mask
With a simple click or stroke on the referring image, the model is able to segment the objects with similar semantics on the target images.
​
https://preview.redd.it/vgzrp0y78rta1.png?width=1724&format=png&auto=webp&v=enabled&s=8d08dea79b5de287e801932c4d7a9ca5b8647124
SEEM understands the spatial relationship very well. Look at the three
/r/MachineLearning
https://redd.it/12lf2l3
We introduce SEEM that can Segment Everything Everywhere with Multi-modal prompts all at once. SEEM allows users to easily segment an image using prompts of different types including visual prompts (points, marks, boxes, scribbles and image segments) and language prompts (text and audio), etc. It can also work with any combinations of prompts or generalize to custom prompts!
​
https://preview.redd.it/8pkzou248rta1.png?width=1265&format=png&auto=webp&v=enabled&s=644f4e560f4e1f40a9cbd19f172af1165bae94d0
Play with the demo on GitHub! https://github.com/UX-Decoder/Segment-Everything-Everywhere-All-At-Once
We emphasize 4 important features of SEEM below.
1. Versatility: work with various types of prompts, for example, clicks, boxes, polygons, scribbles, texts, and referring image;
2. Compositionaliy: deal with any compositions of prompts;
3. Interactivity: interact with user in multi-rounds, thanks to the memory prompt of SEEM to store the session history;
4. Semantic awareness: give a semantic label to any predicted mask;
🔥Click, scribble to mask
With a simple click or stoke from the user, we can generate the masks and the corresponding category labels for it.
​
https://preview.redd.it/tymnl8a58rta1.png?width=1732&format=png&auto=webp&v=enabled&s=a2101364cf8b85f9e114f9cae09c1078f38f030b
🔥Text to mask
SEEM can generate the mask with text input from the user, providing multi-modality interaction with human.
​
https://preview.redd.it/jh6h3fb68rta1.png?width=1708&format=png&auto=webp&v=enabled&s=44c628544cf6f19bb4844d2aa8eafdb6e7040fe0
🔥Referring image to mask
With a simple click or stroke on the referring image, the model is able to segment the objects with similar semantics on the target images.
​
https://preview.redd.it/vgzrp0y78rta1.png?width=1724&format=png&auto=webp&v=enabled&s=8d08dea79b5de287e801932c4d7a9ca5b8647124
SEEM understands the spatial relationship very well. Look at the three
/r/MachineLearning
https://redd.it/12lf2l3
SQLalchemy question
Say for instance I have two classes. A User and Sport class. They are defined as below:
To track the students I have two nominal rolls. One to track the students (let's say by their classrooms) and one for the sports teacher to submit once they have conducted their sport. If the sports nominal roll is submitted, I want the classroom tracker to say if the user attended or not. If the nominal roll is not submitted, I want the tracker to say 'Nominal not submitted'. What would be the best way of going about doing this?
Is there a query I can use - a left join perhaps to capture this query?
/r/flask
https://redd.it/12lrym2
Say for instance I have two classes. A User and Sport class. They are defined as below:
class User(UserMixin, db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(32), index=True, unique=True)
sport_id = db.Column(db.Integer, db.ForeignKey("sports.id"))
attended_sport = db.Column(db.Boolean, default=False)
class Sport(db.Model):
__tablename__ = "sports"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(32))
users = db.relationship("User", backref="sport")
nominal_submitted = db.Column(db.Boolean)
To track the students I have two nominal rolls. One to track the students (let's say by their classrooms) and one for the sports teacher to submit once they have conducted their sport. If the sports nominal roll is submitted, I want the classroom tracker to say if the user attended or not. If the nominal roll is not submitted, I want the tracker to say 'Nominal not submitted'. What would be the best way of going about doing this?
Is there a query I can use - a left join perhaps to capture this query?
/r/flask
https://redd.it/12lrym2
Reddit
r/flask on Reddit: SQLalchemy question
Posted by u/Montags25 - No votes and 1 comment
How to assign a function to a field in models.py
So im making a model for the admin page, there is a field
url = models.CharField(maxlength=255, unique=True, verbosename="Download")
in models.py that i want to call a function
How do I assign a function to the field(the url field shows the url while in admins page)? Thanks!
/r/django
https://redd.it/12lu4s1
So im making a model for the admin page, there is a field
url = models.CharField(maxlength=255, unique=True, verbosename="Download")
in models.py that i want to call a function
download_file for downloading a .txt file when clicked on.How do I assign a function to the field(the url field shows the url while in admins page)? Thanks!
/r/django
https://redd.it/12lu4s1
Reddit
r/django on Reddit: How to assign a function to a field in models.py
Posted by u/SwathedOrange - No votes and 2 comments
Pulling Last 3 Comments from database
I am trying to query my database and pull the last (3) comments from the database and am running into some issues.
Models.py
class Comment(models.Model):
post = models.ForeignKey(Post, relatedname="comments",ondelete=models.CASCADE)
name = models.ForeignKey(User, ondelete=models.CASCADE)
body = RichTextUploadingField(blank=True, null=True)
dateadded = models.DateTimeField(default=timezone.now)
def str(self):
return '%s - %s' % (self.post.title, self.name)
views.py
def base(request):
lastthreecomments = Comment.objects.orderby('-dateadded'):3
context = {
'lastthreecomments' : lastthreecomments
}
return render(request, 'blog/base.html', context)
base.html
{% for comment in lastthreecomments %}
<li>{{ comment.body}}</li>
/r/djangolearning
https://redd.it/12linbg
I am trying to query my database and pull the last (3) comments from the database and am running into some issues.
Models.py
class Comment(models.Model):
post = models.ForeignKey(Post, relatedname="comments",ondelete=models.CASCADE)
name = models.ForeignKey(User, ondelete=models.CASCADE)
body = RichTextUploadingField(blank=True, null=True)
dateadded = models.DateTimeField(default=timezone.now)
def str(self):
return '%s - %s' % (self.post.title, self.name)
views.py
def base(request):
lastthreecomments = Comment.objects.orderby('-dateadded'):3
context = {
'lastthreecomments' : lastthreecomments
}
return render(request, 'blog/base.html', context)
base.html
{% for comment in lastthreecomments %}
<li>{{ comment.body}}</li>
/r/djangolearning
https://redd.it/12linbg
Reddit
r/djangolearning on Reddit: Pulling Last 3 Comments from database
Posted by u/retug_ - 1 vote and 8 comments
FLASK APP CAPTURE NOT WORKING WHEN DEPLOYED ON SERVER
I know nothing of Back-end Web development I just registered for a just for fun hackathon now My app works fine on local machine but when i deploy it on the server it fails to get the camera feed\` Given Below is the app.py file base.html ExecersicebicepCurl.html and bicepcurl.py **this is app.py**
import time
import cv2
from flask import Flask, render_template, Response
import mediapipe as mp
import numpy as np
from project import exerciseAI, yogaAI
#-----------------Routing----------------------------------
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/exercise/biceps-curl')
def exerciseBicepsCurl():
return render_template('exerciseBicepsCurl.html')
@app.route('/exercise/push-ups')
def exercisePushUps():
/r/flask
https://redd.it/12luau3
I know nothing of Back-end Web development I just registered for a just for fun hackathon now My app works fine on local machine but when i deploy it on the server it fails to get the camera feed\` Given Below is the app.py file base.html ExecersicebicepCurl.html and bicepcurl.py **this is app.py**
import time
import cv2
from flask import Flask, render_template, Response
import mediapipe as mp
import numpy as np
from project import exerciseAI, yogaAI
#-----------------Routing----------------------------------
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/exercise/biceps-curl')
def exerciseBicepsCurl():
return render_template('exerciseBicepsCurl.html')
@app.route('/exercise/push-ups')
def exercisePushUps():
/r/flask
https://redd.it/12luau3
Reddit
r/flask on Reddit: FLASK APP CAPTURE NOT WORKING WHEN DEPLOYED ON SERVER
Posted by u/Gold_Hovercraft3122 - 1 vote and 2 comments
Release: NiceGUI 1.2.7 with ui.download, easier color definitions, "aggrid from pandas dataframe" and much more
With 21 contributors the just released NiceGUI 1.2.7 is again a wonderful demonstration of the strong growing community behind our easy to use web-based GUI library for Python. NiceGUI has a very gentle learning curve while still offering the option for advanced customizations. By following a backend-first philosophy you can focus on writing Python code. All the web development details are handled behind the scenes.
### New features and enhancements
- introduce `ui.download`
- introduce color arguments for elements like
- allow running in Python’s interactive mode by auto-disabling reload
- allow creating
- fix navigation links behind reverse proxy with subpath
- allow sending "leading" and/or "trailing" events when throttling
- raise an exception when hiding internal routes with
- add “dark” color to
### Documentation
- enhance Trello "drag and drop" example to use a ToDo data model
- add workaround to docs for native mode when WebView2Loader.dll fails load
- add documentation and demo about element borders inside a
- add hint about exception when running executable with no console on Windows
Of course the release also includes some bugfixes (see release notes for details). Thanks to everyone who was involved in making this release happen.
/r/Python
https://redd.it/12m03v5
With 21 contributors the just released NiceGUI 1.2.7 is again a wonderful demonstration of the strong growing community behind our easy to use web-based GUI library for Python. NiceGUI has a very gentle learning curve while still offering the option for advanced customizations. By following a backend-first philosophy you can focus on writing Python code. All the web development details are handled behind the scenes.
### New features and enhancements
- introduce `ui.download`
- introduce color arguments for elements like
ui.button that accept Quasar, Tailwind, and CSS colors- allow running in Python’s interactive mode by auto-disabling reload
- allow creating
ui.aggrid from pandas dataframe- fix navigation links behind reverse proxy with subpath
- allow sending "leading" and/or "trailing" events when throttling
- raise an exception when hiding internal routes with
app.add_static_files- add “dark” color to
ui.colors### Documentation
- enhance Trello "drag and drop" example to use a ToDo data model
- add workaround to docs for native mode when WebView2Loader.dll fails load
- add documentation and demo about element borders inside a
ui.card- add hint about exception when running executable with no console on Windows
Of course the release also includes some bugfixes (see release notes for details). Thanks to everyone who was involved in making this release happen.
/r/Python
https://redd.it/12m03v5
GitHub
nicegui/examples/nginx_subpath at main · zauberzeug/nicegui
Create web-based interfaces with Python. The nice way. - nicegui/examples/nginx_subpath at main · zauberzeug/nicegui
Logging code mess
Way overdue for me but I started getting a lot more detailed with my logging. I'm finding it really clutters up the code though. Are there any best practices people use? When I have a two line method that has another two lines for logging it just starts feeling clunky.
Is there a way to be more elegant about it or is this just how it is with production code?
Alternatively are there any good code repos you guys can point me to that you think implement this stuff well?
/r/Python
https://redd.it/12lzpvi
Way overdue for me but I started getting a lot more detailed with my logging. I'm finding it really clutters up the code though. Are there any best practices people use? When I have a two line method that has another two lines for logging it just starts feeling clunky.
Is there a way to be more elegant about it or is this just how it is with production code?
Alternatively are there any good code repos you guys can point me to that you think implement this stuff well?
/r/Python
https://redd.it/12lzpvi
Reddit
r/Python on Reddit: Logging code mess
Posted by u/BoiElroy - 11 votes and 21 comments
How do you guys handle pandas and its sh*tty data type inference
I often like to dump CSVs with 100s of columns and millions of rows into python pandas. and I find it very very frustrating when it gets various data types for columns wrong. nothing helps
including `infer_objects().dtypes` and `convert_dtypes().dtypes`
how do you guys auto-detect dtypes for your columns?
is there a better library out there ?
/r/Python
https://redd.it/12m2gn8
I often like to dump CSVs with 100s of columns and millions of rows into python pandas. and I find it very very frustrating when it gets various data types for columns wrong. nothing helps
including `infer_objects().dtypes` and `convert_dtypes().dtypes`
how do you guys auto-detect dtypes for your columns?
is there a better library out there ?
/r/Python
https://redd.it/12m2gn8
Reddit
r/Python on Reddit: How do you guys handle pandas and its sh*tty data type inference
Posted by u/dronedesigner - 13 votes and 56 comments
[Crosspost] Introducing BungIO - a python bungie.net / destiny 2 api wrapper
Original Post: https://www.reddit.com/r/DestinyTheGame/comments/12lt3f1/introducing_bungio_a_python_bungie_api_wrapper/
---
**Features**
* Python 3.10+
* Asynchronous
* 100% typed and raw api coverage
* Ratelimit compliant
* Manifest support
* OAuth2 support
* Easily used in combination with other libraries like FastApi and discord wrappers
**Github**: https://github.com/Kigstn/BungIO
**Docs & Getting Started**: https://bungio.readthedocs.io/en/latest/
**Guides**: https://bungio.readthedocs.io/en/latest/Guides/basic/
---
While the bungie api is very extensive with a **lot** of functionality, it is IMO very confusing for new users. It also has a bunch of inconsistencies and suboptimal documentation. So as a side project, I've been working on making it more accessible for new people and api veterans.
Fast forward a few months, I'm ready to share BungIO with you all. I've been using it for my personal discord bot for ~half a year now and hopefully ironed out all the major kinks. It is designed to be easy to use, but still requires you to loosely know the api.
## Full API Coverage
What sets this library apart from other projects is that it has full api coverage - every single route is fully typed and returns fully typed python classes! And better yet, the api is automatically generated from the api spec bungie publishes. This means when there is an update to the api, it needs literally one button click from me to update
/r/Python
https://redd.it/12m2kpe
Original Post: https://www.reddit.com/r/DestinyTheGame/comments/12lt3f1/introducing_bungio_a_python_bungie_api_wrapper/
---
**Features**
* Python 3.10+
* Asynchronous
* 100% typed and raw api coverage
* Ratelimit compliant
* Manifest support
* OAuth2 support
* Easily used in combination with other libraries like FastApi and discord wrappers
**Github**: https://github.com/Kigstn/BungIO
**Docs & Getting Started**: https://bungio.readthedocs.io/en/latest/
**Guides**: https://bungio.readthedocs.io/en/latest/Guides/basic/
---
While the bungie api is very extensive with a **lot** of functionality, it is IMO very confusing for new users. It also has a bunch of inconsistencies and suboptimal documentation. So as a side project, I've been working on making it more accessible for new people and api veterans.
Fast forward a few months, I'm ready to share BungIO with you all. I've been using it for my personal discord bot for ~half a year now and hopefully ironed out all the major kinks. It is designed to be easy to use, but still requires you to loosely know the api.
## Full API Coverage
What sets this library apart from other projects is that it has full api coverage - every single route is fully typed and returns fully typed python classes! And better yet, the api is automatically generated from the api spec bungie publishes. This means when there is an update to the api, it needs literally one button click from me to update
/r/Python
https://redd.it/12m2kpe
Reddit
r/DestinyTheGame on Reddit: Introducing BungIO - a python bungie api wrapper
Posted by u/Kigstn - 911 votes and 55 comments
Can I add column to the result of a query?
I query a table like this:
I get something in return that looks like this:
Can I add to this so that it will look like this:
I tried this:
and that doesn't work.
Am I supposed to
/r/flask
https://redd.it/12ley46
I query a table like this:
check = Example.query.filter_by(example_attribute=1).all()I get something in return that looks like this:
[Example('1','something', something again')]Can I add to this so that it will look like this:
[Example('1', 'something', 'something again', 'another something')]I tried this:
for x in check:
x.add_columns({'added column': 'another something'})
and that doesn't work.
Am I supposed to
JSON.dumps this and then add it?/r/flask
https://redd.it/12ley46
Reddit
r/flask on Reddit: Can I add column to the result of a query?
Posted by u/miamiredo - 2 votes and 5 comments
Pdfkit vs weasyprint ?
I have a pretty heavy website and want to generate pdf tickets , can be up to 20 per user per order, I already have pdfkit installed and working nicely with a small users number. But as my website grows I ask myself what is the better option between those two? Or is there a better third option …
My main concern is scalability and performance, my setup is a docker compose with django and celery for async pdf generation, hosted on aws elastic beanstalk with their auto scaling.
Can someone share his experience with pdf generation in django ?
Thanks guys for reading
/r/django
https://redd.it/12m7t68
I have a pretty heavy website and want to generate pdf tickets , can be up to 20 per user per order, I already have pdfkit installed and working nicely with a small users number. But as my website grows I ask myself what is the better option between those two? Or is there a better third option …
My main concern is scalability and performance, my setup is a docker compose with django and celery for async pdf generation, hosted on aws elastic beanstalk with their auto scaling.
Can someone share his experience with pdf generation in django ?
Thanks guys for reading
/r/django
https://redd.it/12m7t68
Reddit
r/django on Reddit: Pdfkit vs weasyprint ?
Posted by u/Then_Level7997 - 8 votes and 12 comments
Django REST Framework's TokenAuthentication VS JWTs
Hello guys, can someone explain why they would prefer one over the other? In terms of security, use case etc.
/r/django
https://redd.it/12mhff1
Hello guys, can someone explain why they would prefer one over the other? In terms of security, use case etc.
/r/django
https://redd.it/12mhff1
Reddit
r/django on Reddit: Django REST Framework's TokenAuthentication VS JWTs
Posted by u/Charlesu49 - 3 votes and 2 comments
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/12mirgo
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/12mirgo
Reddit
r/Python on Reddit: Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Posted by u/Im__Joseph - 1 vote and no comments
How to generate URL from @app.route url in FLASK?
I have a Flask code with decorator u/app.route(/bestApp) to fetch my data from Fetch API javascript.
this is my app.py :
​
​
@
​
​
and this is my script.js
​
​
​
​
​
whenever i download my file, it works but the problem is the link that shown in browser is like “http://127.0.0.1:5000/bestApp”
how to convert http://127.0.0.1:5000/bestApp to normal URL? such http://127.0.0.1:5000/42342jnkjsahdkajsda87391237921dask.
I don’t wanna use Blob Object Url or Data URI.
/r/flask
https://redd.it/12kkjfd
I have a Flask code with decorator u/app.route(/bestApp) to fetch my data from Fetch API javascript.
this is my app.py :
​
​
@
app.route('/bestApp', methods=['GET', 'POST'])def bestapp():app_data = AppDataFromUrl(app_url)json.dumps(app_data)permitted_directory='static/assets/upload/'return send_from_directory(directory=permitted_directory, path=filename,as_attachment=True)​
​
and this is my script.js
​
​
async function getExtract() {try {const response = await fetch("/bestApp", {method: "post",body: new FormData(document.querySelector(".testform")),});​
console.log(response);}​
​
whenever i download my file, it works but the problem is the link that shown in browser is like “http://127.0.0.1:5000/bestApp”
how to convert http://127.0.0.1:5000/bestApp to normal URL? such http://127.0.0.1:5000/42342jnkjsahdkajsda87391237921dask.
I don’t wanna use Blob Object Url or Data URI.
/r/flask
https://redd.it/12kkjfd
Reddit
r/flask on Reddit: How to generate URL from @app.route url in FLASK?
Posted by u/Ok-Entertainment7595 - 2 votes and 5 comments
This week I made my first ever python script! It scrapes and translates a single Japanese website for hotel bookings asynchronously. Please come take a look :)
There is a hotel in Japan that will give you the insanely low price of $40 per night if you book a 30 day chunk all at once. Their site only lets you search a single location one day at a time though, so I decided to make this and learn everything from scratch along the way. The most ironic part is, I didn't find a single booking! I think they discontinued the offer... I was going to make a frontend with English translations for regular use too...
I'm openly accepting tips and advice on how to design these things better. It's probably pretty simple for you, but it took me awhile to figure out! Eventually I'd like to swap careers into tech :) If you have any ideas for what to make next be sure to leave your suggestion!
The code on github: https://github.com/Gornel/apa\_scraper/blob/main/list\_gatherer.py
A youtube of the first time I ran it: https://www.youtube.com/watch?v=cGUOLdaKBuE
/r/Python
https://redd.it/12m6obx
There is a hotel in Japan that will give you the insanely low price of $40 per night if you book a 30 day chunk all at once. Their site only lets you search a single location one day at a time though, so I decided to make this and learn everything from scratch along the way. The most ironic part is, I didn't find a single booking! I think they discontinued the offer... I was going to make a frontend with English translations for regular use too...
I'm openly accepting tips and advice on how to design these things better. It's probably pretty simple for you, but it took me awhile to figure out! Eventually I'd like to swap careers into tech :) If you have any ideas for what to make next be sure to leave your suggestion!
The code on github: https://github.com/Gornel/apa\_scraper/blob/main/list\_gatherer.py
A youtube of the first time I ran it: https://www.youtube.com/watch?v=cGUOLdaKBuE
/r/Python
https://redd.it/12m6obx
GitHub
apa_scraper/list_gatherer.py at main · Gornel/apa_scraper
Look for bookings on apahotel.com. Contribute to Gornel/apa_scraper development by creating an account on GitHub.
Here's my project to explore stress control through controlled breathing using Python, BLE, and the Polar H10 Heart Rate monitor
Hey r/Python,
I've been exploring the data available from the widely available Polar H10 heart rate monitor. The Bleak package provides a simple way to connect to the device, and stream heart rate, acceleration, and ECG data.
In this project I looked into the relationship between breathing rate and heart rate variability, a common indicator of physiological stress response.
Github repo: https://github.com/kbre93/dont-hold-your-breath
/r/Python
https://redd.it/12mi0ij
Hey r/Python,
I've been exploring the data available from the widely available Polar H10 heart rate monitor. The Bleak package provides a simple way to connect to the device, and stream heart rate, acceleration, and ECG data.
In this project I looked into the relationship between breathing rate and heart rate variability, a common indicator of physiological stress response.
Github repo: https://github.com/kbre93/dont-hold-your-breath
/r/Python
https://redd.it/12mi0ij
GitHub
GitHub - kieranabrennan/dont-hold-your-breath: Breathing analysis with Polar H10 Heart Rate Monitor
Breathing analysis with Polar H10 Heart Rate Monitor - kieranabrennan/dont-hold-your-breath
What is the best way to store marketplace commissions and payouts in a database after each purchase?
The basic idea is that the marketplace takes payments on behalf of the businesses and every 2 weeks the platform sends the money to the business while keeping 5% as commission.
Each time a user purchases a product we create a new Purchase object:
class Purchase(models.Model):
created = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(User)
product = models.ForeignKey(Product)
quantity = models.IntegerField(null=True, blank=True)
price = models.DecimalField(max_digits=10, decimal_places=2)
total_price = models.DecimalField(max_digits=10, decimal_places=2)
​
Apart from this, we need to store commissions and payouts information in our database. I was thinking of creating 3 models:
* PlatformComission (gets created each time a purchase happens, and stores the amount that we earned on that purchase)
* BusinessEarning (gets created each time a purchase happens, and stores the amount we need to pay the business)
* Payout (gets created every 2 weeks when the payout is sent, gets linked to all the Business Earnings during those 2 weeks with a many to many
/r/django
https://redd.it/12msfa6
The basic idea is that the marketplace takes payments on behalf of the businesses and every 2 weeks the platform sends the money to the business while keeping 5% as commission.
Each time a user purchases a product we create a new Purchase object:
class Purchase(models.Model):
created = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(User)
product = models.ForeignKey(Product)
quantity = models.IntegerField(null=True, blank=True)
price = models.DecimalField(max_digits=10, decimal_places=2)
total_price = models.DecimalField(max_digits=10, decimal_places=2)
​
Apart from this, we need to store commissions and payouts information in our database. I was thinking of creating 3 models:
* PlatformComission (gets created each time a purchase happens, and stores the amount that we earned on that purchase)
* BusinessEarning (gets created each time a purchase happens, and stores the amount we need to pay the business)
* Payout (gets created every 2 weeks when the payout is sent, gets linked to all the Business Earnings during those 2 weeks with a many to many
/r/django
https://redd.it/12msfa6
Reddit
r/django on Reddit: What is the best way to store marketplace commissions and payouts in a database after each purchase?
Posted by u/adrenaline681 - No votes and no comments
Choose Your Weapon: Survival Strategies for Depressed AI Academics
https://arxiv.org/abs/2304.06035
/r/MachineLearning
https://redd.it/12lxavs
https://arxiv.org/abs/2304.06035
/r/MachineLearning
https://redd.it/12lxavs
Reddit
r/MachineLearning on Reddit: Choose Your Weapon: Survival Strategies for Depressed AI Academics
Posted by u/togelius - No votes and 16 comments