Skip to main content

Python package chat2pdf

Project description

chat2pdf

Python Pypi Docs LOC Downloads Downloads License Forks Issues Project Status DOI GitHub Repo stars GitHub repo size Donate

  • chat2pdf is Python package

Star this repo if you like it! ⭐️

Installation

  • Install chat2pdf from PyPI (recommended). chat2pdf is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • A new environment can be created as follows:
conda create -n env_chat2pdf python=3.12
conda activate env_chat2pdf
pip install chat2pdf            # normal install
pip install --upgrade chat2pdf # or update if needed
  • Alternatively, you can install from the GitHub source:
# Directly install from github source
pip install -e git://github.com/erdogant/chat2pdf.git@0.1.0#egg=master
pip install git+https://github.com/erdogant/chat2pdf#egg=master
pip install git+https://github.com/erdogant/chat2pdf

# By cloning
git clone https://github.com/erdogant/chat2pdf.git
cd chat2pdf
pip install -U -e .

Import chat2pdf package

from chat2pdf import chat2pdf

Example by using PDF files

# Import
from chat2pdf import chat2pdf
# Initialize
client = chat2pdf(model='Phi3')

# Check prompt
print(client.prompt)

client.pdf_read([r'C:\my_personal_pdf.pdf'])
print(client.context)

question = "Create a summary with at most 100 words"
client.question(question)

# print(client.response)
client.question('What was my first question?')

Example by adding alternatively context:

# Import
from chat2pdf import chat2pdf
# Initialize
client = chat2pdf()

# print the prompt text
print(client.prompt)

# Change prompt:
# client.prompt = "Use Dutch as language."

client.context = """
The Eiffel Tower is a wrought iron lattice tower on the Champ de Mars in Paris, France.
It is named after the engineer Gustave Eiffel, whose company designed and built the tower.
The tower is 324 meters (1,063 ft) tall, about the same height as an 81-story building, and the tallest structure in Paris.
The number of visitors on yearly basis is 10.000.
"""
print(client.context)

# question = "How many people visit the Eiffel Tower?"
# question = "How width is the Eiffel Tower?"
question = "How tall is the Eiffel Tower?"

# Template
print(client.template)

# Now ask the question
client.question(question)

# Reponse
# print(client.response)

Example by adding directly Context:

streamlit run chat2pdf.py

References

Citation

Please cite in your publications if this is useful for your research (see citation).

Maintainers

Contribute

  • All kinds of contributions are welcome!
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Licence

See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chat2pdf-1.0.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

chat2pdf-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file chat2pdf-1.0.0.tar.gz.

File metadata

  • Download URL: chat2pdf-1.0.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for chat2pdf-1.0.0.tar.gz
Algorithm Hash digest
SHA256 47755ee63fba1e2aceac0f3ac04e5fe19cbfe1661378fd90528733c9d9fcab39
MD5 7e57cc4893f3960140b40c4c99844a70
BLAKE2b-256 9c6a93a502099a479a3de8387cf60944f0759c0d35ec535512b93cf7fe595de8

See more details on using hashes here.

File details

Details for the file chat2pdf-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: chat2pdf-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for chat2pdf-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9d5261afa3a1c0ef318aa56e963399e8472bc2c3998b79846bcd9c971a63298
MD5 41fc5c1232f83a533db2c8c2c06b8833
BLAKE2b-256 2f15b190966bffc2083cb9521c650064f5a0ee6aaae10c9d0b553f172e6d5af3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page