litdb 2.1.3__tar.gz → 2.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: litdb
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
@@ -42,6 +42,7 @@ Requires-Dist: webvtt-py
42
42
  Requires-Dist: streamlit
43
43
  Requires-Dist: pyperclip
44
44
  Requires-Dist: PIL
45
+ Requires-Dist: pillow_heif
45
46
 
46
47
  #+title: litdb - a literature and document database
47
48
 
@@ -64,6 +65,7 @@ The idea is you add papers to your database, and then you can search it with nat
64
65
  6. https://youtube.com/live/SUtvtc7l6y0 litdb + GPT enhancements
65
66
  7. https://youtube.com/live/3FZ1ROnCC6Y litdb + LiteLLM and streamlit
66
67
  8. https://www.youtube.com/live/IKKTQSTXQmc litdb + Youtube and audio
68
+ 9. https://youtube.com/live/MEf9rPI0Z1M litdb + Image search with text and image queries using CLIP
67
69
 
68
70
  ** installation
69
71
 
@@ -19,6 +19,7 @@ The idea is you add papers to your database, and then you can search it with nat
19
19
  6. https://youtube.com/live/SUtvtc7l6y0 litdb + GPT enhancements
20
20
  7. https://youtube.com/live/3FZ1ROnCC6Y litdb + LiteLLM and streamlit
21
21
  8. https://www.youtube.com/live/IKKTQSTXQmc litdb + Youtube and audio
22
+ 9. https://youtube.com/live/MEf9rPI0Z1M litdb + Image search with text and image queries using CLIP
22
23
 
23
24
  ** installation
24
25
 
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "litdb"
10
- version = "2.1.3"
10
+ version = "2.1.4"
11
11
  authors = [
12
12
  {name = "John Kitchin", email = "jkitchin@andrew.cmu.edu"},
13
13
  ]
@@ -65,7 +65,8 @@ dependencies = [
65
65
 
66
66
  # image clip search
67
67
  "pyperclip",
68
- "PIL"
68
+ "PIL",
69
+ "pillow_heif"
69
70
  ]
70
71
 
71
72
  [project.scripts]
@@ -31,6 +31,7 @@ import tabulate
31
31
  from tqdm import tqdm
32
32
  import webbrowser
33
33
 
34
+
34
35
  from .utils import get_config, init_litdb
35
36
  from .db import get_db, add_source, add_work, add_author, update_filter, add_bibtex
36
37
  from .openalex import get_data, get_text
@@ -38,7 +39,7 @@ from .pdf import add_pdf
38
39
  from .bibtex import dump_bibtex
39
40
  from .youtube import get_youtube_doc
40
41
  from .audio import is_audio_url, get_audio_text, record
41
- from .images import add_image, image_query
42
+ from .images import add_image, image_query, image_extensions
42
43
 
43
44
  with warnings.catch_warnings():
44
45
  warnings.filterwarnings("ignore", category=UserWarning, module="pydantic")
@@ -111,7 +112,7 @@ def add(
111
112
  These are one time additions.
112
113
 
113
114
  """
114
- print(sources)
115
+
115
116
  for source in tqdm(sources):
116
117
  # a work
117
118
  if source.startswith("10.") or "doi.org" in source:
@@ -123,11 +124,7 @@ def add(
123
124
 
124
125
  add_work(source, references, citing, related)
125
126
 
126
- elif (
127
- source.endswith(".png")
128
- or source.endswith(".jpg")
129
- or source.endswith(".jpeg")
130
- ):
127
+ elif os.path.splitext(source)[1].lower() in image_extensions:
131
128
  add_image(source)
132
129
 
133
130
  # works from an author
@@ -8,19 +8,23 @@ search the images either by textual descriptions, or by using similar images.
8
8
  from .db import get_db
9
9
  from sentence_transformers import SentenceTransformer
10
10
  from PIL import Image, ImageGrab
11
+ from pillow_heif import register_heif_opener
11
12
  import numpy as np
12
13
  import datetime
13
14
  import os
14
15
  import pyperclip
15
16
 
17
+ register_heif_opener()
16
18
 
17
- model = SentenceTransformer("clip-ViT-B-32")
19
+ image_extensions = Image.registered_extensions().keys()
18
20
 
21
+ model = SentenceTransformer("clip-ViT-B-32")
19
22
  db = get_db()
20
23
 
21
24
 
22
25
  def add_image(path):
23
26
  """Embed and add the image in path to db."""
27
+
24
28
  emb = model.encode(Image.open(path))
25
29
 
26
30
  q = """insert or ignore into
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: litdb
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
@@ -42,6 +42,7 @@ Requires-Dist: webvtt-py
42
42
  Requires-Dist: streamlit
43
43
  Requires-Dist: pyperclip
44
44
  Requires-Dist: PIL
45
+ Requires-Dist: pillow_heif
45
46
 
46
47
  #+title: litdb - a literature and document database
47
48
 
@@ -64,6 +65,7 @@ The idea is you add papers to your database, and then you can search it with nat
64
65
  6. https://youtube.com/live/SUtvtc7l6y0 litdb + GPT enhancements
65
66
  7. https://youtube.com/live/3FZ1ROnCC6Y litdb + LiteLLM and streamlit
66
67
  8. https://www.youtube.com/live/IKKTQSTXQmc litdb + Youtube and audio
68
+ 9. https://youtube.com/live/MEf9rPI0Z1M litdb + Image search with text and image queries using CLIP
67
69
 
68
70
  ** installation
69
71
 
@@ -33,3 +33,4 @@ webvtt-py
33
33
  streamlit
34
34
  pyperclip
35
35
  PIL
36
+ pillow_heif
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes