dwani 0.1.12__tar.gz → 0.1.14__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.
@@ -0,0 +1,25 @@
1
+ # Include essential files
2
+ include README.md
3
+ include LICENSE
4
+
5
+ # Include all Python files in the dwani package
6
+ recursive-include dwani *.py
7
+
8
+ # Exclude the examples directory and its contents
9
+ exclude examples/*
10
+ recursive-exclude examples *
11
+
12
+ # Exclude build artifacts and virtual environment
13
+ exclude dist/*
14
+ exclude dwani.egg-info/*
15
+ exclude venv/*
16
+ recursive-exclude dist *
17
+ recursive-exclude dwani.egg-info *
18
+ recursive-exclude venv *
19
+
20
+ # Exclude other common unwanted files
21
+ exclude .git/*
22
+ exclude .gitignore
23
+ exclude *.pyc
24
+ exclude *.pyo
25
+ exclude __pycache__/*
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dwani
3
- Version: 0.1.12
4
- Summary: Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)
3
+ Version: 0.1.14
4
+ Summary: Multimodal API for Indian + European languages (Chat, Vision, TTS, ASR, Translate, Docs)
5
5
  Author-email: sachin <python@dwani.ai>
6
6
  License: MIT License
7
7
 
@@ -32,10 +32,16 @@ Requires-Python: >=3.8
32
32
  Description-Content-Type: text/markdown
33
33
  License-File: LICENSE
34
34
  Requires-Dist: requests>=2.25.0
35
+ Requires-Dist: openai
35
36
  Dynamic: license-file
36
37
 
37
38
  # dwani.ai - python library
38
39
 
40
+ - dwani.ai is self-hosted GenAI platform for multimodal AI inference.
41
+
42
+ - Image, Speech, Docs, Text supported today !!
43
+
44
+ - dwani.ai - is now compatible with OpenAI Spec
39
45
 
40
46
  ### Install the library
41
47
  ```bash
@@ -43,7 +49,10 @@ pip install --upgrade dwani
43
49
  ```
44
50
 
45
51
  ### Languages supported
46
- - Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
52
+ - Indian
53
+ - Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi Odia, Punjabi, Tamil, Telugu
54
+ - European
55
+ - English, German
47
56
 
48
57
  ### Setup the credentials
49
58
  ```python
@@ -55,63 +64,44 @@ dwani.api_key = os.getenv("DWANI_API_KEY")
55
64
  dwani.api_base = os.getenv("DWANI_API_BASE_URL")
56
65
  ```
57
66
 
67
+ - Check examples folder for detailed use cases
68
+ - [examples/chat.py](examples/chat.py)
69
+ - [examples/vision.py](examples/vision.py)
70
+ - [examples/docs.py](examples/docs.py)
71
+ - [examples/speech.py](examples/speech.py)
72
+ - [examples/asr.py](examples/asr.py)
73
+
74
+
58
75
 
59
76
  ### Text Query
60
77
  ---
61
- - With model selection
62
- - gemma3 (default), qwen3, sarvam-m
78
+ - gemma3 (default)
63
79
 
64
- ---
65
- - gemma3 - with translation
66
- ```python
67
- resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
68
- print(resp)
69
- ```
70
- ```json
71
- {'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
72
- ```
73
-
74
- - gemma3 - without translation
75
- ```python
76
- resp = dwani.Chat.direct(prompt="Hello!", model="gemma3")
77
- print(resp)
78
- ```
79
- ```json
80
- {'response': 'Hello! I am Dwani, ready to assist you with information pertaining to India, specifically Karnataka. '}
81
- ```
80
+ ```python
81
+ resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
82
+ print(resp)
83
+ ```
84
+ ```json
85
+ {'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
86
+ ```
82
87
 
83
88
  ---
84
89
  ### Vision Query
85
90
  ---
86
- - With model selection
87
- - gemma3 (default), moondream, smolvla
88
-
89
- - gemma3 - with translation
90
- ```python
91
- result = dwani.Vision.caption(
92
- file_path="image.png",
93
- query="Describe this logo",
94
- src_lang="english",
95
- tgt_lang="kannada",
96
- model="gemma3"
97
- )
98
- print(result)
99
- ```
100
- ```json
101
- {'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
102
- ```
103
- - gemma3 - without translation
104
- ```python
105
- result = dwani.Vision.caption_direct(
106
- file_path="image.png",
107
- query="Describe this logo",
108
- model="gemma3"
109
- )
110
- print(result)
111
- ```
112
- ```json
113
- {'answer': 'The logo displays a publishing overview stating that changes are under review, with a production rollout initiated at version sixty-four point one point one, expanding to sixteen countries/regions including Australia and Bangladesh.'}
114
- ```
91
+ - gemma3 (default)
92
+ ```python
93
+ result = dwani.Vision.caption(
94
+ file_path="image.png",
95
+ query="Describe this logo",
96
+ src_lang="english",
97
+ tgt_lang="kannada",
98
+ model="gemma3"
99
+ )
100
+ print(result)
101
+ ```
102
+ ```json
103
+ {'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
104
+ ```
115
105
 
116
106
  ---
117
107
  ### Speech to Text - Automatic Speech Recognition (ASR)
@@ -137,7 +127,7 @@ print(resp)
137
127
  ### Text to Speech - Speech Synthesis
138
128
  ---
139
129
  ```python
140
- response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav")
130
+ response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav", language="kannada")
141
131
  with open("output.wav", "wb") as f:
142
132
  f.write(response)
143
133
  ```
dwani-0.1.14/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # dwani.ai - python library
2
+
3
+ - dwani.ai is self-hosted GenAI platform for multimodal AI inference.
4
+
5
+ - Image, Speech, Docs, Text supported today !!
6
+
7
+ - dwani.ai - is now compatible with OpenAI Spec
8
+
9
+ ### Install the library
10
+ ```bash
11
+ pip install --upgrade dwani
12
+ ```
13
+
14
+ ### Languages supported
15
+ - Indian
16
+ - Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi Odia, Punjabi, Tamil, Telugu
17
+ - European
18
+ - English, German
19
+
20
+ ### Setup the credentials
21
+ ```python
22
+ import dwani
23
+ import os
24
+
25
+ dwani.api_key = os.getenv("DWANI_API_KEY")
26
+
27
+ dwani.api_base = os.getenv("DWANI_API_BASE_URL")
28
+ ```
29
+
30
+ - Check examples folder for detailed use cases
31
+ - [examples/chat.py](examples/chat.py)
32
+ - [examples/vision.py](examples/vision.py)
33
+ - [examples/docs.py](examples/docs.py)
34
+ - [examples/speech.py](examples/speech.py)
35
+ - [examples/asr.py](examples/asr.py)
36
+
37
+
38
+
39
+ ### Text Query
40
+ ---
41
+ - gemma3 (default)
42
+
43
+ ```python
44
+ resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
45
+ print(resp)
46
+ ```
47
+ ```json
48
+ {'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
49
+ ```
50
+
51
+ ---
52
+ ### Vision Query
53
+ ---
54
+ - gemma3 (default)
55
+ ```python
56
+ result = dwani.Vision.caption(
57
+ file_path="image.png",
58
+ query="Describe this logo",
59
+ src_lang="english",
60
+ tgt_lang="kannada",
61
+ model="gemma3"
62
+ )
63
+ print(result)
64
+ ```
65
+ ```json
66
+ {'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
67
+ ```
68
+
69
+ ---
70
+ ### Speech to Text - Automatic Speech Recognition (ASR)
71
+ ---
72
+ ```python
73
+ result = dwani.ASR.transcribe(file_path="kannada_sample.wav", language="kannada")
74
+ print(result)
75
+ ```
76
+ ```json
77
+ {'text': 'ಕರ್ನಾಟಕ ದ ರಾಜಧಾನಿ ಯಾವುದು'}
78
+ ```
79
+ ---
80
+ ### Translate
81
+ ---
82
+ ```python
83
+ resp = dwani.Translate.run_translate(sentences="hi, i am gaganyatri", src_lang="english", tgt_lang="kannada")
84
+ print(resp)
85
+ ```
86
+ ```json
87
+ {'translations': ['ಹಾಯ್, ನಾನು ಗಗನಯಾತ್ರಿ']}
88
+ ```
89
+ ---
90
+ ### Text to Speech - Speech Synthesis
91
+ ---
92
+ ```python
93
+ response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav", language="kannada")
94
+ with open("output.wav", "wb") as f:
95
+ f.write(response)
96
+ ```
97
+
98
+ #### Document - Extract Text
99
+ ```python
100
+ result = dwani.Documents.run_extract(file_path = "dwani-workshop.pdf", page_number=1, src_lang="english",tgt_lang="kannada" )
101
+ print(result)
102
+ ```
103
+ ```json
104
+ {'pages': [{'processed_page': 1, 'page_content': ' a plain text representation of the document', 'translated_content': 'ಡಾಕ್ಯುಮೆಂಟ್ನ ಸರಳ ಪಠ್ಯ ಪ್ರಾತಿನಿಧ್ಯವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆ, ಅದನ್ನು ಸ್ವಾಭಾವಿಕವಾಗಿ ಓದುವಂತೆಃ'}]}
105
+ ```
106
+
107
+ - Website -> [dwani.ai](https://dwani.ai)
108
+
109
+
110
+ <!--
111
+ ## local development
112
+ pip install -e .
113
+
114
+
115
+ pip install twine build
116
+ rm -rf dist/
117
+ python -m build
118
+
119
+ python -m twine upload dist/*
120
+
121
+ -->
@@ -30,8 +30,8 @@ class chat:
30
30
 
31
31
  class audio:
32
32
  @staticmethod
33
- def speech(input, response_format="wav"):
34
- return _get_client().speech(input, response_format)
33
+ def speech(input, response_format="wav", language="kannada"):
34
+ return _get_client().speech(input, response_format, language)
35
35
 
36
36
  class vision:
37
37
  @staticmethod
@@ -1,10 +1,11 @@
1
1
  from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
- def audio_speech(client, input, response_format="mp3", output_file=None):
4
+ def audio_speech(client, input, response_format="mp3", output_file=None, language="kannada"):
5
5
  params = {
6
6
  "input": input,
7
- "response_format": response_format
7
+ "response_format": response_format,
8
+ "language": language
8
9
  }
9
10
  resp = requests.post(
10
11
  f"{client.api_base}/v1/audio/speech",
@@ -23,14 +23,13 @@ class DwaniClient:
23
23
  from .chat import chat_create
24
24
  return chat_create(self, prompt=prompt, src_lang=src_lang, tgt_lang=tgt_lang, model=model)
25
25
 
26
-
27
26
  def chat_direct(self, prompt, model="gemma3", system_prompt=""):
28
27
  from .chat import chat_direct
29
28
  return chat_direct(self, prompt=prompt, model=model, system_prompt=system_prompt)
30
29
 
31
- def speech(self, input, response_format="mp3"):
30
+ def speech(self, input, response_format="wav", language="kannada"):
32
31
  from .audio import audio_speech
33
- return audio_speech(self, input=input, response_format=response_format)
32
+ return audio_speech(self, input=input, response_format=response_format, language=language)
34
33
 
35
34
  def caption(self, file_path, query="describe the image", src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
36
35
  from .vision import vision_caption
@@ -58,7 +58,6 @@ def vision_direct(client, file_path, query="describe this image", model="gemma3"
58
58
  raise DwaniAPIError(resp)
59
59
  return resp.json()
60
60
 
61
-
62
61
  def vision_caption(client, file_path, query="describe the image", src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
63
62
  # Validate model
64
63
  valid_models = ["gemma3", "qwen2.5vl", "moondream", "smolvla"]
@@ -99,4 +98,4 @@ class Vision:
99
98
  @staticmethod
100
99
  def caption_direct(file_path, query="describe the image", model="gemma3", system_prompt=""):
101
100
  from . import _get_client
102
- return _get_client().caption_direct(file_path, query, model, system_prompt)
101
+ return _get_client().caption_direct(file_path, query, model, system_prompt)
@@ -1,4 +1,5 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  pyproject.toml
4
5
  dwani/__init__.py
@@ -9,9 +10,4 @@ dwani/client.py
9
10
  dwani/docs.py
10
11
  dwani/exceptions.py
11
12
  dwani/translate.py
12
- dwani/vision.py
13
- dwani.egg-info/PKG-INFO
14
- dwani.egg-info/SOURCES.txt
15
- dwani.egg-info/dependency_links.txt
16
- dwani.egg-info/requires.txt
17
- dwani.egg-info/top_level.txt
13
+ dwani/vision.py
@@ -5,8 +5,8 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "dwani"
7
7
 
8
- version = "0.1.12"
9
- description = "Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)"
8
+ version = "0.1.14"
9
+ description = "Multimodal API for Indian + European languages (Chat, Vision, TTS, ASR, Translate, Docs)"
10
10
  authors = [
11
11
  { name="sachin", email="python@dwani.ai" }
12
12
  ]
@@ -16,6 +16,7 @@ requires-python = ">=3.8"
16
16
 
17
17
  dependencies = [
18
18
  "requests>=2.25.0",
19
+ "openai"
19
20
  ]
20
21
 
21
22
  [project.urls]
dwani-0.1.12/README.md DELETED
@@ -1,132 +0,0 @@
1
- # dwani.ai - python library
2
-
3
-
4
- ### Install the library
5
- ```bash
6
- pip install --upgrade dwani
7
- ```
8
-
9
- ### Languages supported
10
- - Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
11
-
12
- ### Setup the credentials
13
- ```python
14
- import dwani
15
- import os
16
-
17
- dwani.api_key = os.getenv("DWANI_API_KEY")
18
-
19
- dwani.api_base = os.getenv("DWANI_API_BASE_URL")
20
- ```
21
-
22
-
23
- ### Text Query
24
- ---
25
- - With model selection
26
- - gemma3 (default), qwen3, sarvam-m
27
-
28
- ---
29
- - gemma3 - with translation
30
- ```python
31
- resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
32
- print(resp)
33
- ```
34
- ```json
35
- {'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
36
- ```
37
-
38
- - gemma3 - without translation
39
- ```python
40
- resp = dwani.Chat.direct(prompt="Hello!", model="gemma3")
41
- print(resp)
42
- ```
43
- ```json
44
- {'response': 'Hello! I am Dwani, ready to assist you with information pertaining to India, specifically Karnataka. '}
45
- ```
46
-
47
- ---
48
- ### Vision Query
49
- ---
50
- - With model selection
51
- - gemma3 (default), moondream, smolvla
52
-
53
- - gemma3 - with translation
54
- ```python
55
- result = dwani.Vision.caption(
56
- file_path="image.png",
57
- query="Describe this logo",
58
- src_lang="english",
59
- tgt_lang="kannada",
60
- model="gemma3"
61
- )
62
- print(result)
63
- ```
64
- ```json
65
- {'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
66
- ```
67
- - gemma3 - without translation
68
- ```python
69
- result = dwani.Vision.caption_direct(
70
- file_path="image.png",
71
- query="Describe this logo",
72
- model="gemma3"
73
- )
74
- print(result)
75
- ```
76
- ```json
77
- {'answer': 'The logo displays a publishing overview stating that changes are under review, with a production rollout initiated at version sixty-four point one point one, expanding to sixteen countries/regions including Australia and Bangladesh.'}
78
- ```
79
-
80
- ---
81
- ### Speech to Text - Automatic Speech Recognition (ASR)
82
- ---
83
- ```python
84
- result = dwani.ASR.transcribe(file_path="kannada_sample.wav", language="kannada")
85
- print(result)
86
- ```
87
- ```json
88
- {'text': 'ಕರ್ನಾಟಕ ದ ರಾಜಧಾನಿ ಯಾವುದು'}
89
- ```
90
- ---
91
- ### Translate
92
- ---
93
- ```python
94
- resp = dwani.Translate.run_translate(sentences="hi, i am gaganyatri", src_lang="english", tgt_lang="kannada")
95
- print(resp)
96
- ```
97
- ```json
98
- {'translations': ['ಹಾಯ್, ನಾನು ಗಗನಯಾತ್ರಿ']}
99
- ```
100
- ---
101
- ### Text to Speech - Speech Synthesis
102
- ---
103
- ```python
104
- response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav")
105
- with open("output.wav", "wb") as f:
106
- f.write(response)
107
- ```
108
-
109
- #### Document - Extract Text
110
- ```python
111
- result = dwani.Documents.run_extract(file_path = "dwani-workshop.pdf", page_number=1, src_lang="english",tgt_lang="kannada" )
112
- print(result)
113
- ```
114
- ```json
115
- {'pages': [{'processed_page': 1, 'page_content': ' a plain text representation of the document', 'translated_content': 'ಡಾಕ್ಯುಮೆಂಟ್ನ ಸರಳ ಪಠ್ಯ ಪ್ರಾತಿನಿಧ್ಯವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆ, ಅದನ್ನು ಸ್ವಾಭಾವಿಕವಾಗಿ ಓದುವಂತೆಃ'}]}
116
- ```
117
-
118
- - Website -> [dwani.ai](https://dwani.ai)
119
-
120
-
121
- <!--
122
- ## local development
123
- pip install -e .
124
-
125
-
126
- pip install twine build
127
- rm -rf dist/
128
- python -m build
129
-
130
- python -m twine upload dist/*
131
-
132
- -->
@@ -1,168 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: dwani
3
- Version: 0.1.12
4
- Summary: Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)
5
- Author-email: sachin <python@dwani.ai>
6
- License: MIT License
7
-
8
- Copyright (c) 2025 Sachin Shetty
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Homepage, https://github.com/dwani-ai/dwani-python
29
- Project-URL: Source, https://github.com/dwani-ai/dwani-python
30
- Project-URL: Issues, https://github.com/dwani-ai/dwani-python/issues
31
- Requires-Python: >=3.8
32
- Description-Content-Type: text/markdown
33
- License-File: LICENSE
34
- Requires-Dist: requests>=2.25.0
35
- Dynamic: license-file
36
-
37
- # dwani.ai - python library
38
-
39
-
40
- ### Install the library
41
- ```bash
42
- pip install --upgrade dwani
43
- ```
44
-
45
- ### Languages supported
46
- - Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
47
-
48
- ### Setup the credentials
49
- ```python
50
- import dwani
51
- import os
52
-
53
- dwani.api_key = os.getenv("DWANI_API_KEY")
54
-
55
- dwani.api_base = os.getenv("DWANI_API_BASE_URL")
56
- ```
57
-
58
-
59
- ### Text Query
60
- ---
61
- - With model selection
62
- - gemma3 (default), qwen3, sarvam-m
63
-
64
- ---
65
- - gemma3 - with translation
66
- ```python
67
- resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
68
- print(resp)
69
- ```
70
- ```json
71
- {'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
72
- ```
73
-
74
- - gemma3 - without translation
75
- ```python
76
- resp = dwani.Chat.direct(prompt="Hello!", model="gemma3")
77
- print(resp)
78
- ```
79
- ```json
80
- {'response': 'Hello! I am Dwani, ready to assist you with information pertaining to India, specifically Karnataka. '}
81
- ```
82
-
83
- ---
84
- ### Vision Query
85
- ---
86
- - With model selection
87
- - gemma3 (default), moondream, smolvla
88
-
89
- - gemma3 - with translation
90
- ```python
91
- result = dwani.Vision.caption(
92
- file_path="image.png",
93
- query="Describe this logo",
94
- src_lang="english",
95
- tgt_lang="kannada",
96
- model="gemma3"
97
- )
98
- print(result)
99
- ```
100
- ```json
101
- {'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
102
- ```
103
- - gemma3 - without translation
104
- ```python
105
- result = dwani.Vision.caption_direct(
106
- file_path="image.png",
107
- query="Describe this logo",
108
- model="gemma3"
109
- )
110
- print(result)
111
- ```
112
- ```json
113
- {'answer': 'The logo displays a publishing overview stating that changes are under review, with a production rollout initiated at version sixty-four point one point one, expanding to sixteen countries/regions including Australia and Bangladesh.'}
114
- ```
115
-
116
- ---
117
- ### Speech to Text - Automatic Speech Recognition (ASR)
118
- ---
119
- ```python
120
- result = dwani.ASR.transcribe(file_path="kannada_sample.wav", language="kannada")
121
- print(result)
122
- ```
123
- ```json
124
- {'text': 'ಕರ್ನಾಟಕ ದ ರಾಜಧಾನಿ ಯಾವುದು'}
125
- ```
126
- ---
127
- ### Translate
128
- ---
129
- ```python
130
- resp = dwani.Translate.run_translate(sentences="hi, i am gaganyatri", src_lang="english", tgt_lang="kannada")
131
- print(resp)
132
- ```
133
- ```json
134
- {'translations': ['ಹಾಯ್, ನಾನು ಗಗನಯಾತ್ರಿ']}
135
- ```
136
- ---
137
- ### Text to Speech - Speech Synthesis
138
- ---
139
- ```python
140
- response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav")
141
- with open("output.wav", "wb") as f:
142
- f.write(response)
143
- ```
144
-
145
- #### Document - Extract Text
146
- ```python
147
- result = dwani.Documents.run_extract(file_path = "dwani-workshop.pdf", page_number=1, src_lang="english",tgt_lang="kannada" )
148
- print(result)
149
- ```
150
- ```json
151
- {'pages': [{'processed_page': 1, 'page_content': ' a plain text representation of the document', 'translated_content': 'ಡಾಕ್ಯುಮೆಂಟ್ನ ಸರಳ ಪಠ್ಯ ಪ್ರಾತಿನಿಧ್ಯವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆ, ಅದನ್ನು ಸ್ವಾಭಾವಿಕವಾಗಿ ಓದುವಂತೆಃ'}]}
152
- ```
153
-
154
- - Website -> [dwani.ai](https://dwani.ai)
155
-
156
-
157
- <!--
158
- ## local development
159
- pip install -e .
160
-
161
-
162
- pip install twine build
163
- rm -rf dist/
164
- python -m build
165
-
166
- python -m twine upload dist/*
167
-
168
- -->
@@ -1 +0,0 @@
1
- requests>=2.25.0
@@ -1 +0,0 @@
1
- dwani
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes