Unable to send request to containerized flask app
Code for app.py -
from flask import Flask, redirect, urlfor, rendertemplate, request, jsonify
import random
import os
import time
from datetime import datetime
from flasksqlalchemy import SQLAlchemy
from langchaingooglegenai import ChatGoogleGenerativeAI
from langchaincore.messages import HumanMessage, SystemMessage
app = Flask(name)
app.config"SQLALCHEMY_DATABASE_URI" = 'sqlite:///test.db'
db = SQLAlchemy(app)
os.environ"GOOGLE_API_KEY" = ""
class Data(db.Model):
id = db.Column(db.Integer, primarykey=True, autoincrement=True)
request = db.Column(db.Text, nullable=False)
response = db.Column(db.Text)
datetime = db.Column(db.DateTime, default=datetime.utcnow)
# action = db.Column(db.String(80))
def repr(self):
return '<UserData %r - %r>' % (self.request, self.datetime)
@app.route("/", methods = ["POST", "GET"])
def home():
if request.method == "POST":
json = request.getjson()
if json and "query"in json:
question = json'query'
model = ChatGoogleGenerativeAI(model="gemini-pro", convertsystemmessagetohuman=True)
resp = model(
/r/flask
[https://redd.it/1c7tk65
Code for app.py -
from flask import Flask, redirect, urlfor, rendertemplate, request, jsonify
import random
import os
import time
from datetime import datetime
from flasksqlalchemy import SQLAlchemy
from langchaingooglegenai import ChatGoogleGenerativeAI
from langchaincore.messages import HumanMessage, SystemMessage
app = Flask(name)
app.config"SQLALCHEMY_DATABASE_URI" = 'sqlite:///test.db'
db = SQLAlchemy(app)
os.environ"GOOGLE_API_KEY" = ""
class Data(db.Model):
id = db.Column(db.Integer, primarykey=True, autoincrement=True)
request = db.Column(db.Text, nullable=False)
response = db.Column(db.Text)
datetime = db.Column(db.DateTime, default=datetime.utcnow)
# action = db.Column(db.String(80))
def repr(self):
return '<UserData %r - %r>' % (self.request, self.datetime)
@app.route("/", methods = ["POST", "GET"])
def home():
if request.method == "POST":
json = request.getjson()
if json and "query"in json:
question = json'query'
model = ChatGoogleGenerativeAI(model="gemini-pro", convertsystemmessagetohuman=True)
resp = model(
/r/flask
[https://redd.it/1c7tk65
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Can I build a News API ?
So guys, this is my first time building an API. So my question is: is it possible and easy to build a small news API? If yes, where can I can the articles that I should put in the database ?
/r/django
https://redd.it/1c8l4xq
So guys, this is my first time building an API. So my question is: is it possible and easy to build a small news API? If yes, where can I can the articles that I should put in the database ?
/r/django
https://redd.it/1c8l4xq
Reddit
From the django community on Reddit
Explore this post and more from the django community
How do you implement replies comments ?
I'm in the process of building a blog site and trying to implement replies on comments. Example: post -> comment on post -> comment on comment. What is the process of implementing it on models? Any suggestion or help will be greatly appreciated. Thank you very much. Here are some sample scripts.
​
models.py
class Post(models.Model):
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
topic = models.ForeignKey(Topic, on_delete=models.CASCADE, null=True, blank=True)
title = models.CharField(max_length=100)
author = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='posts')
image = models.ImageField(
default="post_images/default.webp",
upload_to="post_images",
null=True, blank=True
)
content = models.TextField()
date_posted = models.DateTimeField(auto_now_add=True)
date_updated = models.DateTimeField(auto_now=True)
/r/djangolearning
https://redd.it/1c8sdez
I'm in the process of building a blog site and trying to implement replies on comments. Example: post -> comment on post -> comment on comment. What is the process of implementing it on models? Any suggestion or help will be greatly appreciated. Thank you very much. Here are some sample scripts.
​
models.py
class Post(models.Model):
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
topic = models.ForeignKey(Topic, on_delete=models.CASCADE, null=True, blank=True)
title = models.CharField(max_length=100)
author = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='posts')
image = models.ImageField(
default="post_images/default.webp",
upload_to="post_images",
null=True, blank=True
)
content = models.TextField()
date_posted = models.DateTimeField(auto_now_add=True)
date_updated = models.DateTimeField(auto_now=True)
/r/djangolearning
https://redd.it/1c8sdez
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Python icon library with 5237 high-quality icons (Tabler Icons wrapper)
What My Project Does:
pytablericons is a Python wrapper for the tabler-icons project, which provides a set of 5237 free MIT-licensed high-quality SVG icons for web projects with each icon being designed on a 24x24 grid and a 2px stroke.
It allows you to load any of those SVG icons directly into a Pillow PNG Image in any size and color without losing quality and without having to download the icons manually or handling the SVG conversion yourself. For the outline icons, the stroke width is customizable as well. All of this is done in just a single line and since the icon is a Pillow Image, it can then be used easily with basically anything (e.g. PyQt5, PyQt6, PySide2, PySide6, Tkinter, etc.)
Target Audience:
This is useful for any Python developer who is working on UI projects and wants to easily display modern icons in any size and color without losing quality and without having to download each icon manually.
Comparison: /
Links:
Preview: https://github.com/niklashenning/pytablericons/assets/58544929/e13fb020-4d5f-4e28-bd5f-0d5659bd6582
GitHub: https://github.com/niklashenning/pytablericons
/r/Python
https://redd.it/1c8ohrp
What My Project Does:
pytablericons is a Python wrapper for the tabler-icons project, which provides a set of 5237 free MIT-licensed high-quality SVG icons for web projects with each icon being designed on a 24x24 grid and a 2px stroke.
It allows you to load any of those SVG icons directly into a Pillow PNG Image in any size and color without losing quality and without having to download the icons manually or handling the SVG conversion yourself. For the outline icons, the stroke width is customizable as well. All of this is done in just a single line and since the icon is a Pillow Image, it can then be used easily with basically anything (e.g. PyQt5, PyQt6, PySide2, PySide6, Tkinter, etc.)
Target Audience:
This is useful for any Python developer who is working on UI projects and wants to easily display modern icons in any size and color without losing quality and without having to download each icon manually.
Comparison: /
Links:
Preview: https://github.com/niklashenning/pytablericons/assets/58544929/e13fb020-4d5f-4e28-bd5f-0d5659bd6582
GitHub: https://github.com/niklashenning/pytablericons
/r/Python
https://redd.it/1c8ohrp
[P] llama-3-70b on Groq with code interpreting
https://github.com/e2b-dev/e2b-cookbook/blob/main/examples/llama-3-code-interpreter/llama_3_code_interpreter_groq.ipynb
/r/MachineLearning
https://redd.it/1c8uiwi
https://github.com/e2b-dev/e2b-cookbook/blob/main/examples/llama-3-code-interpreter/llama_3_code_interpreter_groq.ipynb
/r/MachineLearning
https://redd.it/1c8uiwi
GitHub
e2b-cookbook/examples/llama-3-code-interpreter/llama_3_code_interpreter_groq.ipynb at main · e2b-dev/e2b-cookbook
Examples and guides for using the E2B API. Contribute to e2b-dev/e2b-cookbook development by creating an account on GitHub.
Hey folks 👋,
Does anyone know how to set up Tailwind with Django? I've been using the CDN, but now I need to push to production.
I've searched for how to set it up, but I didn't find anything useful. It's not even in the Tailwind documentation.
/r/django
https://redd.it/1c8va6k
Does anyone know how to set up Tailwind with Django? I've been using the CDN, but now I need to push to production.
I've searched for how to set it up, but I didn't find anything useful. It's not even in the Tailwind documentation.
/r/django
https://redd.it/1c8va6k
Reddit
From the django community on Reddit
Explore this post and more from the django community
How to deploy a Django app that uses SQLite for database on a DigitalOcean droplet
https://www.linkedin.com/pulse/deploy-django-app-sqlite-digitalocean-droplet-bashar-ghadanfar-mq7if/?trackingId=g21WoEygQ9KYWUPoyXg2Ng%3D%3D
/r/django
https://redd.it/1c8om0m
https://www.linkedin.com/pulse/deploy-django-app-sqlite-digitalocean-droplet-bashar-ghadanfar-mq7if/?trackingId=g21WoEygQ9KYWUPoyXg2Ng%3D%3D
/r/django
https://redd.it/1c8om0m
Linkedin
Deploy a Django App with SQLite on a DigitalOcean Droplet
A simple tutorial guide of how to deploy a Django app or website with an SQLite database from your GitHub on to a DigitalOcean droplet running Ubuntu 22.04.
D How important is leetcode in ML?
I recently interviewed with a faang for Applied Data Scientist and it went like this:
- 1x ML interview
- 3x Leetcode interviews
- 1x high level system design interview
How important is leetcode to the actual job of ML / DS practitioners? Is it that important to have 3 leetcode problems vs 1 ml problem?
When I am doing interview prep I just feel like I am wasting time doing leetcode when I could be upskilling in other areas in ML or even other technical skills like K8s, cuda or data engineering.
I am interested in knowing what everyone else thinks about this.
/r/MachineLearning
https://redd.it/1c8ygzl
I recently interviewed with a faang for Applied Data Scientist and it went like this:
- 1x ML interview
- 3x Leetcode interviews
- 1x high level system design interview
How important is leetcode to the actual job of ML / DS practitioners? Is it that important to have 3 leetcode problems vs 1 ml problem?
When I am doing interview prep I just feel like I am wasting time doing leetcode when I could be upskilling in other areas in ML or even other technical skills like K8s, cuda or data engineering.
I am interested in knowing what everyone else thinks about this.
/r/MachineLearning
https://redd.it/1c8ygzl
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1c94bxm
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1c94bxm
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Is Django the right fit for my project? Or overkill?
Hi! I am a SW Engineer hoping to start another passion project. I want to build a very lightweight website that allows a user to customize a prebuilt PC and then order it. This would then put their order in a database that I can look at to build and then ship their custom PC.
I need the website and GUI to be intelligent enough to recommend parts that:
1. Are in stock
2. Avoid bottlenecks
3. Are geared towards their interests (user says they do lots of compilation/encoding I will recommend specific cpu class over gpus etc...)
This intelligence and smart recommendations is why I'm leaning towards a python-based solution so I can develop and really tweak that logic
I really really like python development so am drawn to Django as a solution, however maybe I can make this work with one of those canned-style wordpress sites and a couple of plugins--My thought process was I pay for a few plugins I need, but then why not just code my own plugin, but then why not
/r/django
https://redd.it/1c92icg
Hi! I am a SW Engineer hoping to start another passion project. I want to build a very lightweight website that allows a user to customize a prebuilt PC and then order it. This would then put their order in a database that I can look at to build and then ship their custom PC.
I need the website and GUI to be intelligent enough to recommend parts that:
1. Are in stock
2. Avoid bottlenecks
3. Are geared towards their interests (user says they do lots of compilation/encoding I will recommend specific cpu class over gpus etc...)
This intelligence and smart recommendations is why I'm leaning towards a python-based solution so I can develop and really tweak that logic
I really really like python development so am drawn to Django as a solution, however maybe I can make this work with one of those canned-style wordpress sites and a couple of plugins--My thought process was I pay for a few plugins I need, but then why not just code my own plugin, but then why not
/r/django
https://redd.it/1c92icg
Reddit
From the django community on Reddit
Explore this post and more from the django community
I made a web app using Flask that converts YouTube videos into step-by-step tutorial guides
Hey guys. I've been working on this side project for the past month. It generates a step-by-step tutorial guide for YouTube videos that you can follow along without watching long videos. Best suited for tutorial videos but can work for other videos aswell. No BS. Just straight to the point.
The guides are generated from pure transcript so you don't have to worry about it being AI. It's my first project as a total beginner. Something I had to do inorder to get out of tutorial hell.
Please let me know if you have any suggestions or if you face any problems or bugs. I would try to fix them to the best of my abilities and as soon as possible. I would appreciate your feedback on this. You can message me directly.
Here's the link: stepify.tech
/r/flask
https://redd.it/1c96l5o
Hey guys. I've been working on this side project for the past month. It generates a step-by-step tutorial guide for YouTube videos that you can follow along without watching long videos. Best suited for tutorial videos but can work for other videos aswell. No BS. Just straight to the point.
The guides are generated from pure transcript so you don't have to worry about it being AI. It's my first project as a total beginner. Something I had to do inorder to get out of tutorial hell.
Please let me know if you have any suggestions or if you face any problems or bugs. I would try to fix them to the best of my abilities and as soon as possible. I would appreciate your feedback on this. You can message me directly.
Here's the link: stepify.tech
/r/flask
https://redd.it/1c96l5o
stepify.tech
Stepify - AI-Powered Video Guides
Get step-by-step tutorials of YouTube videos. Save time with AI-powered guides.
Introducing Stockdex: A Superior Python Package for Real-Time Financial Data Retrieval
Greetings!
I've previously introduced my Python package in this post. Since then, I've significantly enhanced its performance and expanded its capabilities.
# What My Project Does
A lightweight python package designed for the efficient retrieval of financial data from various sources like Yahoo Finance, Nasdaq, Digrin and JustETF websites (somewhat similar to yfinance). This tool provides functionality akin to yfinance but with broader data access.
# Main benefits of stockdex over yfinance
- Fresh data: Yahoo Finance often delays updates to financial data by several days while Nasdaq and other sources typically update on the day reports are released. Stockdex enables access to this fresher data, such as quarterly earnings.
- Broader Data Sources: Unlike yfinance which relies solely on the Yahoo Finance API, Stockdex aggregates data from multiple platforms including Digrin, JustETF, Nasdaq, and Yahoo Finance. For specific examples of data retrieval, refer to this readme.
- Access to Historical Data: Yahoo Finance limits access to the most recent five annual or four quarterly reports. Stockdex, however, taps into sources that maintain extensive historical archives not available through Yahoo Finance.
# Target Audience
The package is targeted at people who are interested in financial analysis using python.
Explore more:
- Github Repo Link
- Pypi link
/r/Python
https://redd.it/1c92iom
Greetings!
I've previously introduced my Python package in this post. Since then, I've significantly enhanced its performance and expanded its capabilities.
# What My Project Does
A lightweight python package designed for the efficient retrieval of financial data from various sources like Yahoo Finance, Nasdaq, Digrin and JustETF websites (somewhat similar to yfinance). This tool provides functionality akin to yfinance but with broader data access.
# Main benefits of stockdex over yfinance
- Fresh data: Yahoo Finance often delays updates to financial data by several days while Nasdaq and other sources typically update on the day reports are released. Stockdex enables access to this fresher data, such as quarterly earnings.
- Broader Data Sources: Unlike yfinance which relies solely on the Yahoo Finance API, Stockdex aggregates data from multiple platforms including Digrin, JustETF, Nasdaq, and Yahoo Finance. For specific examples of data retrieval, refer to this readme.
- Access to Historical Data: Yahoo Finance limits access to the most recent five annual or four quarterly reports. Stockdex, however, taps into sources that maintain extensive historical archives not available through Yahoo Finance.
# Target Audience
The package is targeted at people who are interested in financial analysis using python.
Explore more:
- Github Repo Link
- Pypi link
/r/Python
https://redd.it/1c92iom
Reddit
orgad's comment on "Stockdex: Python Package to Extract Financial Insights From Multiple Sources"
Explore this conversation and more from the Python community
Someone Wants to Buy My SaaS - ?????
Hey! I’ve been working on a SaaS project called Bitezzy (my first one) Bitezzy - Simplify your menu management, which helps restaurants create and manage digital menus that customers can access by scanning a QR code. It’s built with Django, and uses Stripe to handle subscriptions for registered users who create and manage these menus.
Recently, someone approached me with an interest in buying Bitezzy. This is both exciting and a bit overwhelming since it's the first time I've been in this situation. I'm not sure how to value the project or the steps I should take next.
Bitezzy is still in development (I'm not a frontend expert, I'm still learning) and has shown great potential. Figuring out a fair price involves considering the time I've invested and the future market potential (it may work, it may not). There's also an emotional component because I've poured so much into developing it from the ground up.
I'm reaching out to see if anyone here has experience with selling a similar project. Could you share some advice on how I should approach this?
What factors are important to consider when valuing a SaaS focused on service like this?
Is there a standard method
/r/django
https://redd.it/1c943qz
Hey! I’ve been working on a SaaS project called Bitezzy (my first one) Bitezzy - Simplify your menu management, which helps restaurants create and manage digital menus that customers can access by scanning a QR code. It’s built with Django, and uses Stripe to handle subscriptions for registered users who create and manage these menus.
Recently, someone approached me with an interest in buying Bitezzy. This is both exciting and a bit overwhelming since it's the first time I've been in this situation. I'm not sure how to value the project or the steps I should take next.
Bitezzy is still in development (I'm not a frontend expert, I'm still learning) and has shown great potential. Figuring out a fair price involves considering the time I've invested and the future market potential (it may work, it may not). There's also an emotional component because I've poured so much into developing it from the ground up.
I'm reaching out to see if anyone here has experience with selling a similar project. Could you share some advice on how I should approach this?
What factors are important to consider when valuing a SaaS focused on service like this?
Is there a standard method
/r/django
https://redd.it/1c943qz
Bitezzy
BiteZzy - Revolutionize Your Restaurant Management
Discover how our all-in-one platform can help you streamline reservations, online orders, and menu management with cutting-edge technology.
Hosting Flask when taking data transfer costs into consideration question
Hi all,
I'm developing a Flask application and was thinking of hosting it on either Heroku on AWS or possibly even elsewhere. After reading some past posts that drew my attention to this, it occurred to me there are more considerations that I was aware of. My application will have users submitting images (which could be of a good size) so I need to factor in data costs. With this in mind, I would be grateful for any pointers for the best place that would balance good service with (hopefully) fewer costs.
Many thanks
/r/flask
https://redd.it/1c8umxd
Hi all,
I'm developing a Flask application and was thinking of hosting it on either Heroku on AWS or possibly even elsewhere. After reading some past posts that drew my attention to this, it occurred to me there are more considerations that I was aware of. My application will have users submitting images (which could be of a good size) so I need to factor in data costs. With this in mind, I would be grateful for any pointers for the best place that would balance good service with (hopefully) fewer costs.
Many thanks
/r/flask
https://redd.it/1c8umxd
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
My latest TILs about Python
After 10+ years working with it, I keep discovering new features. This is a list of the most recent ones: https://jcarlosroldan.com/post/329
/r/Python
https://redd.it/1c97glg
After 10+ years working with it, I keep discovering new features. This is a list of the most recent ones: https://jcarlosroldan.com/post/329
/r/Python
https://redd.it/1c97glg
J. Carlos Roldán
My latest TILs about Python
After so long, I still find basic stuff in Python that I didn't know about. Here are some of my mos
[D] Meta's H100 figure represents its H100 purchase as per company earnings call 1 Feb 2024. Excludes a further 250,000 H100 equivalents worth of GPU.
/r/MachineLearning
https://redd.it/1c8ydji
/r/MachineLearning
https://redd.it/1c8ydji
Matlab to Python
Hello everyone,
in your opinion what is the best way to convert a Matlab script to a Python one?
Personally I do it by hand, but I also heard about extensions like SMOP etc..
What do you think?
/r/Python
https://redd.it/1c9cjtl
Hello everyone,
in your opinion what is the best way to convert a Matlab script to a Python one?
Personally I do it by hand, but I also heard about extensions like SMOP etc..
What do you think?
/r/Python
https://redd.it/1c9cjtl
Reddit
From the Python community on Reddit: Matlab to Python
Posted by Soggy-Struggle-4195 - 16 votes and 13 comments
Webhost for VOD webapp: noob edition
I have developped a VOD webapp, streaming educational content to subscribers using mux.com, based on django (with sqlite, or something else later), with html/bootstrap and some basic js, matomo for analysis. Landing page has a 3-4 images, and the user-only section has basically navigation buttons, text and the mux player. I expect no more than 10 concurrent logged in users, but would like to be able to scale to 100 as seamlessly as possible if it were to happen (beyond that there would be enough money for scalability to be someone else's job). And I'm quite lost regarding hosting options.
The first question I have is ressource needs. I'm used to simple web hosting of pure html/css, with shared ressources and bandwidth: would that be enough, and until what point? Any requirements beyond python? If I go dedicated ressources, how many Cores / Ram should I need?
The second is the maintenance of the server if I choose VPS/Cloud server. I'm ok/interested to learn how to deploy on a server, but the security/maintenence part of it worries me. Are there intermediate options, something equivalent to a VPS/Cloud but where most security related parts (firewall, software upgrades,...) are handled for me?
Any provider/solution to
/r/django
https://redd.it/1c9dv0x
I have developped a VOD webapp, streaming educational content to subscribers using mux.com, based on django (with sqlite, or something else later), with html/bootstrap and some basic js, matomo for analysis. Landing page has a 3-4 images, and the user-only section has basically navigation buttons, text and the mux player. I expect no more than 10 concurrent logged in users, but would like to be able to scale to 100 as seamlessly as possible if it were to happen (beyond that there would be enough money for scalability to be someone else's job). And I'm quite lost regarding hosting options.
The first question I have is ressource needs. I'm used to simple web hosting of pure html/css, with shared ressources and bandwidth: would that be enough, and until what point? Any requirements beyond python? If I go dedicated ressources, how many Cores / Ram should I need?
The second is the maintenance of the server if I choose VPS/Cloud server. I'm ok/interested to learn how to deploy on a server, but the security/maintenence part of it worries me. Are there intermediate options, something equivalent to a VPS/Cloud but where most security related parts (firewall, software upgrades,...) are handled for me?
Any provider/solution to
/r/django
https://redd.it/1c9dv0x
Reddit
Webhost for VOD webapp: noob edition : r/django
128K subscribers in the django community. News and links for Django developers.