Making an NLP application in python
I need to make an NLP tool for an IoT application that will basically take queries from users (like 'turn on the pump for 1 minute and inform Mark') and will process it to extract 3 basic things for further processing \- the device (pump), duration (1 minute) and the person (Mark). How should I proceed with this?
/r/Python
https://redd.it/8q7c7c
I need to make an NLP tool for an IoT application that will basically take queries from users (like 'turn on the pump for 1 minute and inform Mark') and will process it to extract 3 basic things for further processing \- the device (pump), duration (1 minute) and the person (Mark). How should I proceed with this?
/r/Python
https://redd.it/8q7c7c
reddit
r/Python - Making an NLP application in python
2 votes and 0 so far on reddit
Help with quick app - what should I use?
So I am wanting to make a private, sort of quick hobbyist web app using python to gather data from Monopoly games. It definitely does not have to have many features but I would like it to have a mainly visual interface (not command line / text\-based) and do enough that it does not take away from playing Monopoly. My desire is for the player\-facing web app to be essentially like a VERY small Venmo for monopoly where players can keep track of their balances and send money to each other with a short memo attached. Additionally, I would like it to keep track of owned properties and property upgrades with the ability to trade them with other players and keep track of the amount that the properties were traded for. On the backend, I would like to keep track of all actions into a SQLite database for later analysis of the transactions themselves. The application would be a web app that *each* player can access from their phones (not an app downloaded from an app store), and mostly single view with a couple pop\-up dialogue., Maybe a settings page if we are getting frisky with the features. \-\-I really only say all this to describe the (shallow) depth of this project and what I would need it to do. This definitely is not a 'scalability' or 'big data' problem.
In the past i have used Google Sheets to keep track of data and had my players learned on my preferred format, but it really made the game not fun to actually play (which inevitably affects the data itself). **I am hoping for guidance with finding a small stack of packages/technologies in Python I could use quickly to build this app, and hopefully have it remain free to develop** (server hosted locally, spun up for each monopoly game is an idea). The app's main purpose is to gather data, not be a robust tool to use with every Monopoly game (maybe eventually...), but still be visual enough for the players and not detract from gameplay. I have been needing to learn Flask/Django and this could be my opportunity but would they be too much for this project? What would be the *easiest* stack with the smallest learning curve?
Thanks all for the input!
/r/Python
https://redd.it/8q7mdr
So I am wanting to make a private, sort of quick hobbyist web app using python to gather data from Monopoly games. It definitely does not have to have many features but I would like it to have a mainly visual interface (not command line / text\-based) and do enough that it does not take away from playing Monopoly. My desire is for the player\-facing web app to be essentially like a VERY small Venmo for monopoly where players can keep track of their balances and send money to each other with a short memo attached. Additionally, I would like it to keep track of owned properties and property upgrades with the ability to trade them with other players and keep track of the amount that the properties were traded for. On the backend, I would like to keep track of all actions into a SQLite database for later analysis of the transactions themselves. The application would be a web app that *each* player can access from their phones (not an app downloaded from an app store), and mostly single view with a couple pop\-up dialogue., Maybe a settings page if we are getting frisky with the features. \-\-I really only say all this to describe the (shallow) depth of this project and what I would need it to do. This definitely is not a 'scalability' or 'big data' problem.
In the past i have used Google Sheets to keep track of data and had my players learned on my preferred format, but it really made the game not fun to actually play (which inevitably affects the data itself). **I am hoping for guidance with finding a small stack of packages/technologies in Python I could use quickly to build this app, and hopefully have it remain free to develop** (server hosted locally, spun up for each monopoly game is an idea). The app's main purpose is to gather data, not be a robust tool to use with every Monopoly game (maybe eventually...), but still be visual enough for the players and not detract from gameplay. I have been needing to learn Flask/Django and this could be my opportunity but would they be too much for this project? What would be the *easiest* stack with the smallest learning curve?
Thanks all for the input!
/r/Python
https://redd.it/8q7mdr
reddit
Help with quick app - what should I use? • r/Python
So I am wanting to make a private, sort of quick hobbyist web app using python to gather data from Monopoly games. It definitely does not have to...
Django REST and OAuth2
Hello everyone!
I'm starting a project with *Django REST framework* , and I have a question about the login operation, I'm planning to use OAuth2.
When I get the user information, login, password, etc, and I use a serialize, all that information is going to a json api, but what about the password? It will be there in the middle of the json for everyone (I mean everyone who is working in the project) to see it? I'm just wondering, I didn't start the project yet, about to start this next week.
/r/django
https://redd.it/8q5xvf
Hello everyone!
I'm starting a project with *Django REST framework* , and I have a question about the login operation, I'm planning to use OAuth2.
When I get the user information, login, password, etc, and I use a serialize, all that information is going to a json api, but what about the password? It will be there in the middle of the json for everyone (I mean everyone who is working in the project) to see it? I'm just wondering, I didn't start the project yet, about to start this next week.
/r/django
https://redd.it/8q5xvf
reddit
r/django - Django REST and OAuth2
4 votes and 2 so far on reddit
Forms: Attribute Error
As part of learning Django, I am currently trying to build a little project. At this stage, as a preliminary task, I am attempting to pass the user\-input from the Form to the template (results.html). However, I am getting the error the below, and I can't seem figure out why!
If anybody could let me know what I'm doing wrong, I'd be greatly appreciative :D Thanks in advance!
**ERROR**
AttributeError at /search_query/ 'SearchHashtagForm' object has no attribute 'cleaned_data'
Request Method: POST
Django Version: 2.0
Exception Type: AttributeError
Exception Value:'SearchHashtagForm' object has no attribute 'cleaned_data'
Exception Location:/mnt/data/.python-3.6/lib/python3.6/site-packages/django/forms/models.py in _save_m2m, line 424
Python Executable:/mnt/data/.python-3.6/bin/python
Python Version:3.6.5
Python Path:['/mnt/project', '/mnt/data/.python-3.6/lib/python36.zip', '/mnt/data/.python-3.6/lib/python3.6', '/mnt/data/.python-3.6/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6', '/mnt/data/.python-3.6/lib/python3.6/site-packages']
**models.py**
from django.db import models
class Location(models.Model):
""" Model representing a Location, attached to Hashtag objects through a M2M
relationship """
name = models.CharField(max_length=1400)
def __str__(self):
return self.name
class Hashtag(models.Model):
""" Model representing a specific Hashtag serch by user """
search_text = models.CharField(max_length=140, primary_key=True)
locations = models.ManyToManyField(Location, blank=True)
def __str__(self):
""" String for representing the Model object (search_text) """
return self.search_text
def display_locations(self):
""" Creates a list of the locations """
# Return a list of location names attached to the Hashtag model
return self.locations.values_list('name', flat=True).all()
**forms.py**
from django import forms
from django.forms import ModelForm
from .models import Location, Hashtag
class SearchHashtagForm(ModelForm):
""" ModelForm for user to search by hashtag """
def clean_hashtag(self):
data = self.cleaned_data['search_text']
# Check search_query doesn't include '#'. If so, remove it
if data[0] == '#':
data = data[1:]
# return the cleaned data
return data
class Meta:
model = Hashtag
fields = ['search_text',]
labels = {'search_text':('Hashtag Search'), }
help_texts = { 'search_text': ('Enter a hashtag to search.'), }
**views.py**
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from .models import Location, Hashtag
from .forms import SearchHashtagForm
def hashtag_search_index(request):
""" View function for user to enter search query """
hashtag_search = SearchHashtagForm()
# If POST, process Form data
if request.method == 'POST':
# Create a form instance and populate it with data from request (binding)
form = SearchHashtagForm(request.POST)
# Check if form is valid
if form.is_valid():
hashtag_search.search_text = form.cleaned_data['search_text']
hashtag_search.save()
# redirect to a new URL
return HttpResponseRedirect(reverse('mapping_twitter:results'))
# If GET (or any other method), create the default form
else:
form = SearchHashtagForm()
context = {'form':form}
return render(request, 'mapping_twitter/hashtag_search_index.html', context)
def results(request):
""" View for
As part of learning Django, I am currently trying to build a little project. At this stage, as a preliminary task, I am attempting to pass the user\-input from the Form to the template (results.html). However, I am getting the error the below, and I can't seem figure out why!
If anybody could let me know what I'm doing wrong, I'd be greatly appreciative :D Thanks in advance!
**ERROR**
AttributeError at /search_query/ 'SearchHashtagForm' object has no attribute 'cleaned_data'
Request Method: POST
Django Version: 2.0
Exception Type: AttributeError
Exception Value:'SearchHashtagForm' object has no attribute 'cleaned_data'
Exception Location:/mnt/data/.python-3.6/lib/python3.6/site-packages/django/forms/models.py in _save_m2m, line 424
Python Executable:/mnt/data/.python-3.6/bin/python
Python Version:3.6.5
Python Path:['/mnt/project', '/mnt/data/.python-3.6/lib/python36.zip', '/mnt/data/.python-3.6/lib/python3.6', '/mnt/data/.python-3.6/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6', '/mnt/data/.python-3.6/lib/python3.6/site-packages']
**models.py**
from django.db import models
class Location(models.Model):
""" Model representing a Location, attached to Hashtag objects through a M2M
relationship """
name = models.CharField(max_length=1400)
def __str__(self):
return self.name
class Hashtag(models.Model):
""" Model representing a specific Hashtag serch by user """
search_text = models.CharField(max_length=140, primary_key=True)
locations = models.ManyToManyField(Location, blank=True)
def __str__(self):
""" String for representing the Model object (search_text) """
return self.search_text
def display_locations(self):
""" Creates a list of the locations """
# Return a list of location names attached to the Hashtag model
return self.locations.values_list('name', flat=True).all()
**forms.py**
from django import forms
from django.forms import ModelForm
from .models import Location, Hashtag
class SearchHashtagForm(ModelForm):
""" ModelForm for user to search by hashtag """
def clean_hashtag(self):
data = self.cleaned_data['search_text']
# Check search_query doesn't include '#'. If so, remove it
if data[0] == '#':
data = data[1:]
# return the cleaned data
return data
class Meta:
model = Hashtag
fields = ['search_text',]
labels = {'search_text':('Hashtag Search'), }
help_texts = { 'search_text': ('Enter a hashtag to search.'), }
**views.py**
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from .models import Location, Hashtag
from .forms import SearchHashtagForm
def hashtag_search_index(request):
""" View function for user to enter search query """
hashtag_search = SearchHashtagForm()
# If POST, process Form data
if request.method == 'POST':
# Create a form instance and populate it with data from request (binding)
form = SearchHashtagForm(request.POST)
# Check if form is valid
if form.is_valid():
hashtag_search.search_text = form.cleaned_data['search_text']
hashtag_search.save()
# redirect to a new URL
return HttpResponseRedirect(reverse('mapping_twitter:results'))
# If GET (or any other method), create the default form
else:
form = SearchHashtagForm()
context = {'form':form}
return render(request, 'mapping_twitter/hashtag_search_index.html', context)
def results(request):
""" View for
search results for locations associated with user-inputted
search_text """
search_text = hashtag_search
location = get_object_or_404(Hashtag, search_text=search_text)
location_list = location.display_locations()
context = {'search_text':search_text, 'location_list':location_list}
return render(request, 'mapping_twitter/results.html', context)
/r/djangolearning
https://redd.it/8q8buz
search_text """
search_text = hashtag_search
location = get_object_or_404(Hashtag, search_text=search_text)
location_list = location.display_locations()
context = {'search_text':search_text, 'location_list':location_list}
return render(request, 'mapping_twitter/results.html', context)
/r/djangolearning
https://redd.it/8q8buz
reddit
r/djangolearning - Forms: Attribute Error
1 votes and 3 so far on reddit
authtools: do not create one-to-one profile object on user creation.
Hello,
I am using the authtools plugin to manage the user and its profile in django, but when I create the user, it does not create its profile, I have to go to the admin part of the site and create it manually.
I separated the applications into account and profile.
This is the profiles model:
class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key=True)
slug = models.UUIDField(default=uuid.uuid4, blank=True, editable=False)
email_verified = models.BooleanField("Email verified", default=True)
This is the signal.py, that is inside of the profiles application:
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_profile_handler(sender, instance, created, **kwargs):
if not created:
return
profile = models.Profile(user=instance)
profile.save()
logger.info('New user profile for {} created'.format(instance))
This is the admin.py of the account app:
class UserProfileInline(admin.StackedInline):
model = Profile
class NewUserAdmin(NamedUserAdmin):
inlines = [UserProfileInline]
list_display = ('is_active', 'email', 'name', 'permalink',
'is_superuser', 'is_staff',)
# 'View on site' didn't work since the original User model needs to
# have get_absolute_url defined. So showing on the list display
# was a workaround.
def permalink(self, obj):
url = reverse("profiles:show",
kwargs={"slug": obj.profile.slug})
# Unicode hex b6 is the Pilcrow sign
return format_html('<a href="{}">{}</a>'.format(url, '\xb6'))
admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
admin.site.register(Profile)
When I signup a user, both the user and the profile objects are created, only they are not linked. Why is that?
Thank you
/r/django
https://redd.it/8q4ob3
Hello,
I am using the authtools plugin to manage the user and its profile in django, but when I create the user, it does not create its profile, I have to go to the admin part of the site and create it manually.
I separated the applications into account and profile.
This is the profiles model:
class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key=True)
slug = models.UUIDField(default=uuid.uuid4, blank=True, editable=False)
email_verified = models.BooleanField("Email verified", default=True)
This is the signal.py, that is inside of the profiles application:
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_profile_handler(sender, instance, created, **kwargs):
if not created:
return
profile = models.Profile(user=instance)
profile.save()
logger.info('New user profile for {} created'.format(instance))
This is the admin.py of the account app:
class UserProfileInline(admin.StackedInline):
model = Profile
class NewUserAdmin(NamedUserAdmin):
inlines = [UserProfileInline]
list_display = ('is_active', 'email', 'name', 'permalink',
'is_superuser', 'is_staff',)
# 'View on site' didn't work since the original User model needs to
# have get_absolute_url defined. So showing on the list display
# was a workaround.
def permalink(self, obj):
url = reverse("profiles:show",
kwargs={"slug": obj.profile.slug})
# Unicode hex b6 is the Pilcrow sign
return format_html('<a href="{}">{}</a>'.format(url, '\xb6'))
admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
admin.site.register(Profile)
When I signup a user, both the user and the profile objects are created, only they are not linked. Why is that?
Thank you
/r/django
https://redd.it/8q4ob3
reddit
r/django - authtools: do not create one-to-one profile object on user creation.
2 votes and 3 so far on reddit
Modern Database Interfaces For The Command Line (Interview)
https://www.podcastinit.com/dbcli-with-amjith-ramanujam-episode-165/
/r/Python
https://redd.it/8q8v2j
https://www.podcastinit.com/dbcli-with-amjith-ramanujam-episode-165/
/r/Python
https://redd.it/8q8v2j
Podcast.__init__('Python')
Modern Database Clients On The Command Line with Amjith Ramanujam - Episode 165
The command line is a powerful and resilient interface for getting work done, but the user experience is often lacking. This can be especially pronounced in database clients because of the amount of information being transferred and examined. To help improve…
Adding forms dynamically to a Django formset
https://medium.com/@taranjeet/adding-forms-dynamically-to-a-django-formset-375f1090c2b0
/r/django
https://redd.it/8q9dew
https://medium.com/@taranjeet/adding-forms-dynamically-to-a-django-formset-375f1090c2b0
/r/django
https://redd.it/8q9dew
Medium
Adding forms dynamically to a Django formset
Add multiple ordered similar arguments to manage command
I'm trying to build out a command that'll looker similar to this
`python manage.py gen-data primary=10-state with=30-users with=30-visits`
The goal here is to do test-data generation where the command doesn't become crazy for any of our front end devs. That command would do something like create 10 states, create 30 users who live in each state, and create 30 web visits for each of those users.
I know how to do the actual generation of the data, but I can't seem to find out how to handle having the same argument repeated like that.
Any help would be much appreciated.
Solved:
Turns out you can do a list object as a arg
parser.add_argument(
'--with', default=[], dest='withs', action='append',
help="Specify district ids by comma separated list.")
` python manage.py generate_data --model=user --with=Super --with=cali --with=frag --with=ilistice --with=xpial --with=idocious`
`['Super', 'cali', 'frag', 'ilistice', 'xpial', 'idocious']`
/r/django
https://redd.it/8q9scf
I'm trying to build out a command that'll looker similar to this
`python manage.py gen-data primary=10-state with=30-users with=30-visits`
The goal here is to do test-data generation where the command doesn't become crazy for any of our front end devs. That command would do something like create 10 states, create 30 users who live in each state, and create 30 web visits for each of those users.
I know how to do the actual generation of the data, but I can't seem to find out how to handle having the same argument repeated like that.
Any help would be much appreciated.
Solved:
Turns out you can do a list object as a arg
parser.add_argument(
'--with', default=[], dest='withs', action='append',
help="Specify district ids by comma separated list.")
` python manage.py generate_data --model=user --with=Super --with=cali --with=frag --with=ilistice --with=xpial --with=idocious`
`['Super', 'cali', 'frag', 'ilistice', 'xpial', 'idocious']`
/r/django
https://redd.it/8q9scf
reddit
Add multiple ordered similar arguments to manage command • r/django
I'm trying to build out a command that'll looker similar to this `python manage.py gen-data primary=10-state with=30-users with=30-visits` The...
parver: a package to parse and manipulate PEP440 version numbers
https://github.com/RazerM/parver
/r/Python
https://redd.it/8qb4zl
https://github.com/RazerM/parver
/r/Python
https://redd.it/8qb4zl
GitHub
GitHub - RazerM/parver: Parse and manipulate version numbers.
Parse and manipulate version numbers. Contribute to RazerM/parver development by creating an account on GitHub.
[D] Improving Language Understanding with Unsupervised Learning
https://blog.openai.com/language-unsupervised/
/r/MachineLearning
https://redd.it/8qbzom
https://blog.openai.com/language-unsupervised/
/r/MachineLearning
https://redd.it/8qbzom
Getting started with Apache Kafka in Python
http://blog.adnansiddiqi.me/getting-started-with-apache-kafka-in-python/?utm_source=r_python_kafka&utm_medium=reddit&utm_campaign=c_r_python_kafka
/r/Python
https://redd.it/8qe9d9
http://blog.adnansiddiqi.me/getting-started-with-apache-kafka-in-python/?utm_source=r_python_kafka&utm_medium=reddit&utm_campaign=c_r_python_kafka
/r/Python
https://redd.it/8qe9d9
Adnan's Random bytes
Getting started with Apache Kafka in Python
Learn the basics of Kafka and write a sample distributed application in Python.
Web Scrape YouTube channel for video info and a table of contents using Python 3.6 and Beautiful Soup (V1.1)
https://teklern.blogspot.com/2018/06/web-scrape-youtube-channel-for-video.html
/r/Python
https://redd.it/8qds2e
https://teklern.blogspot.com/2018/06/web-scrape-youtube-channel-for-video.html
/r/Python
https://redd.it/8qds2e
Blogspot
Web Scrape YouTube channel for video info and a table of contents using Python 3.6 and Beautiful Soup (V1.1)
I have a YouTube channel for my videos to teach programming and needed to create a nice table of contents for a web page. YouTube alwa...
[P] Simple Tensorflow implementation of StarGAN (CVPR 2018 Oral)
/r/MachineLearning
https://redd.it/8qh7e5
/r/MachineLearning
https://redd.it/8qh7e5
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/8qj87y
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/8qj87y
reddit
r/Python - What's everyone working on this week?
1 votes and 1 so far on reddit
JWT Auth with AWS Cognito
How does one get started with using warrant/cognito for flask JWT auth ?
We can login to cognito using warrant and it returns a token, but from there we don't know how to proceed in flask.
https://stackoverflow.com/questions/50801247/python-and-flask-for-authentication-with-amazon-cognito
/r/flask
https://redd.it/8qj3pp
How does one get started with using warrant/cognito for flask JWT auth ?
We can login to cognito using warrant and it returns a token, but from there we don't know how to proceed in flask.
https://stackoverflow.com/questions/50801247/python-and-flask-for-authentication-with-amazon-cognito
/r/flask
https://redd.it/8qj3pp
Stack Overflow
Python and Flask for authentication with Amazon Cognito
Here's the end goal: to write a Flask app that supports login/authentication using Amazon Cognito User Pools. Both frameworks are fairly new to me.
I used warrant serverless authentication to get ...
I used warrant serverless authentication to get ...
Python script I wrote that tells whether it’s a Pizza or Not a Pizza
https://youtu.be/m_S7caqSFxc
/r/Python
https://redd.it/8qh9gf
https://youtu.be/m_S7caqSFxc
/r/Python
https://redd.it/8qh9gf
YouTube
Python image recognition
It’s a simple python script that I wrote it allows us to classify image. In my case I am using Clarifai Api to determine whether the image is pizza or not It...
May Release of Saleor: getting ready for GDPR
https://medium.com/saleor/may-release-of-saleor-getting-ready-for-gdpr-4bcb8c99438d
/r/django
https://redd.it/8qide2
https://medium.com/saleor/may-release-of-saleor-getting-ready-for-gdpr-4bcb8c99438d
/r/django
https://redd.it/8qide2
Medium
May Release of Saleor: getting ready for GDPR
Welcome to the May 2018 release of Saleor!
Celery 4.2.0 released!
http://docs.celeryproject.org/en/master/changelog.html#changelog
/r/Python
https://redd.it/8qj5ez
http://docs.celeryproject.org/en/master/changelog.html#changelog
/r/Python
https://redd.it/8qj5ez