PanosKolyvakis / AI-to-LaTeX

WebUI full-stack application featuring Google programmable search engine, Beautiful soup web scrapping, GPT to produce high quality LaTeX documents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Here is an illustration of what the WebUI looks like (while undergoing development)

Flask Blog and PDF Generator

This project is a Flask-based web application that utilizes Google Custom Search and OpenAI's GPT to generate blog posts based on user queries. It then formats these posts into LaTeX and compiles them into PDFs for download. This README outlines how to set up and run the project locally.

There is a video on this URL of my BLOG clearly illustrating all the incorporated features

The user can now do consecutive calls to the GPT API to improve the document according to preferences (e.g. you can click refine button to add/remove paragraphs, or customize the document in general).

The current plan is to cache and keep data of good LLM responses (prompt- answer pairs), such that a GPT LLM is fine tuned in the future once enough high quality training examples are generated for training. This is due to OpenAI making fine-tuned models accessible by the API recently ...

I have recently added a .tex editor that can be used to recompile the document to the webUI. The editor may be used to edit the document manually and recompile.

*Once the project is completed, I plan to deploy it on the web, possibly using Heroku or AWS.

Features

  • Google Custom Search to fetch relevant URLs based on user queries.
  • OpenAI's GPT integration for generating rich, relevant content for blog posts.
  • LaTeX for formatting and compiling blog posts into downloadable PDF documents.
  • A simple, user-friendly web interface for submitting queries and downloading blog posts as PDFs.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.6 or later installed on your machine.
  • Flask installed in your Python environment.
  • Access to OpenAI's API and a valid API key.
  • A Google Custom Search Engine set up with an API key and Search Engine ID.
  • LaTeX installed on your system for PDF generation.

Installation

To install the project dependencies, run the following command in your virtual environment:

pip install -r requirements.txt

Configuration

http://localhost:5000

NOTE: to initialize the prohect you need to add a configuration.py file with the following script:

class Config:
    def __init__(self):
        self.response_path = 'static/docs/response.tex'
        self.openapi_key = 'fromAPIkey'
        self.google_API_KEY = 'fromGoogleCustomSearchEnginges'
        self.google_CSE_ID = 'fromGoogleCustomSearchEnginges'
        self.DEBUG_URL = 'https://en.wikipedia.org/wiki/Cattle'
        self.html_template= 'templates'
        self.tex_file = 'static/docs/response.tex'

alternatively you can add variables to your path

To install all LaTeX tlmgr packages if a template doesnt compile

Ensure that the .sh script is executable

chmod +x install_latex_packages.sh

Run the script to install all .tex-required packages NOTE: you probably need to run sudo

sudo ./install_latex_packages.sh

About

WebUI full-stack application featuring Google programmable search engine, Beautiful soup web scrapping, GPT to produce high quality LaTeX documents

License:MIT License


Languages

Language:Python 57.3%Language:HTML 28.4%Language:JavaScript 7.7%Language:CSS 3.7%Language:TeX 2.2%Language:Shell 0.7%