Posts

Showing posts from February, 2023

Now saving Questions and Answer from Chatgpt

 Two new things of value have been added last night. First is that I've created a separate "Module" or stand-alone file for specialized functions. In this instance the new code that was added takes the question and answer from ChatGPT and adds a record into a new MySQL table. In due course modifications to table will be needed.  I will be adding similar logic for the sign-up logic.  I have to decide if there is a need to have the debate functionality work online or off-line

Set up a link to ask CHATGPT a question

Image
 Tonight I added a link and 2 HTML pages tonight. From the Intro page a user can click a link to a page to ask a question of CHATGPT and get a response. Here is the question page: When you enter a question - and then click submit you will be sent to the answer page presentation: Any question can be asked theoretically. A next steps are to save the question and the answer into the DB. I will need similar processing for the Sign-in processing  

Issues with PyQT5, import class and Flask

Image
 Attempting to get QTDesigner files to work from the web. Q:\Python Training\FlaskWebProject2 - this is the current working Visual Studio version that I'm looking to fit a sample python editor from QTDesigner - Q:\Python Training\xxxx\sample_editor. It uses PyQT5 and appears to be a non-web python app. Having errors getting a "Class" in the FlaskWebProject2 to work - even a very simple example from a web article: " https://favtutor.com/blogs/import-class-from-another-file-python#:~:text=Python%20provides%20us%20with%20various,functions%20using%20the%20import%20statements. " Will check out - "https://flask.palletsprojects.com/en/2.2.x/views/"

An observation

 I don't claim to be an expert on many things - if any. I am functional in many area's. In this effort there are many new things. I've been tinkering with Python since about 2020. This is an initial effort outside of UDEMY in working with FLASK. I am new to PythonAnywhere also.  Mashing up Python, Flask, HTML/Web with SQL in at least 2 flavors into a project that I can make visible from my phone (without phone tech) is a thing I am enjoying. There is a sense that I am currently only limited by my imagination.  There will be technical limits, deprecations, spelling and syntax hurdles. There will eventually be refactoring of the original code and design to acquire the ability to scale up.  There is potential - if for no other purpose than as a portfolio asset - a "Look what I can do!" in front and behind.  Remember "http://benconnolly.pythonanywhere.com" is a sandbox entity - for now

Successful connection to MySQL from HTML

Image
 Found a page: https://www.geeksforgeeks.org/retrieving-html-from-data-using-flask/ with a screen shot that parallels what I want to do - in terms of connecting to the DB.  Below is the screen shot that I was able to implement in FLASH_APP.PY and ThreeIndex.html in VDP. Below is the Threeindex routine from FLASK_APP.py: @app.route('/Threeindex', methods =["GET", "POST"]) def Threeindex():     """Renders the home page."""     from datetime import date, datetime, timedelta     import mysql.connector     import sys     if request.method == "POST":        # getting input with name = fname in HTML form        first_name = request.form.get("fname")        print('InfoForm a debugginng  message 2 ', file=sys.stderr)        print(first_name, file=sys.stderr)        # getting input with name = lname in HTML form     ...

Feature Deprecated, DB connections from HTML and Presentation

Image
 First an image of new code and the HTML as it is presented: Since the last entry I've been looking for a way to take data and write it out to the MySQL DB. I created a page Threeindex.html. I have added to buttons and to the menu/nav bar at the top. Only the NavBar at the top gets to the page. I've got the page to work with 2 different platforrms. Tried following the video from UDEMY, but it turns out the Radiobutton and Selectfield methods are deprecated or obsolete in some fashion. Something about FlaskForm/wtforms that is a problem. That took a while to settle that was the issue. I did manage to add error trapping. The "Learn more" buttons for Threeindex demonstrate that feature My continuing to connect what is typed into the HTML in Threeindex to the MySQL. The page Twoindex.html accessed through Flask_app.py code adds the same record - but there is no interaction

CHATGPT in the beginning

In the middle of Dec 2022 I heard about an Artificial Intelligence product called - CHATGPT from OPENAI. I started checking it out and found that Python examples. I got myself an API - coded from the example and got my version to work - it returned answers.   On or about the Feb 2 2023 I start watching a UDEMY class and building a test effort in Python-Flask. It was titled " https://www.udemy.com/course/python-and-flask-bootcamp-create-websites-using-flask ". According to Udemy I purchased the course Aug 20, 2020. This was in the middle of COVID lockdown. I had been laid off from Halfpenny in April of that year. That summer I start a number of online training classes.  So I finally got around to this class on Flask. I created a new Visual Studio 2022 community "FlaskWebProject1". While watching the course, I wanted to take my initial CHATGPT code and create a front-end to be able to ask different questions of CHATGPT without changing the programming code.  As I move...