dwani 0.1.12__py3-none-any.whl → 0.1.14__py3-none-any.whl
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.
- dwani/__init__.py +2 -2
- dwani/audio.py +3 -2
- dwani/client.py +2 -3
- dwani/vision.py +1 -2
- {dwani-0.1.12.dist-info → dwani-0.1.14.dist-info}/METADATA +43 -53
- dwani-0.1.14.dist-info/RECORD +14 -0
- dwani-0.1.12.dist-info/RECORD +0 -14
- {dwani-0.1.12.dist-info → dwani-0.1.14.dist-info}/WHEEL +0 -0
- {dwani-0.1.12.dist-info → dwani-0.1.14.dist-info}/licenses/LICENSE +0 -0
- {dwani-0.1.12.dist-info → dwani-0.1.14.dist-info}/top_level.txt +0 -0
dwani/__init__.py
CHANGED
@@ -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
|
dwani/audio.py
CHANGED
@@ -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",
|
dwani/client.py
CHANGED
@@ -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="
|
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
|
dwani/vision.py
CHANGED
@@ -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,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dwani
|
3
|
-
Version: 0.1.
|
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
|
-
|
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
|
-
-
|
62
|
-
- gemma3 (default), qwen3, sarvam-m
|
78
|
+
- gemma3 (default)
|
63
79
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
```
|
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
|
-
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
dwani/__init__.py,sha256=rV93n_1nOed4ak7NOcwtDjxsT7JbDIivhtRRcrDR80A,3040
|
2
|
+
dwani/asr.py,sha256=BAdqivQd57NJZX1dSY-J6EFi8TDdyuhf_AyCPcQ0M7w,1719
|
3
|
+
dwani/audio.py,sha256=CFQrYU-KLwO7pCh_R7c1SSDJ6bugE5_av7lV8XTl-dY,936
|
4
|
+
dwani/chat.py,sha256=Tui52XBhUyDyN2rOFoLme4oB0Q8fkD9_0tFDAnRzoaU,2979
|
5
|
+
dwani/client.py,sha256=fGtnY9L0u_mymY7xUeFDhCBX7P7fd4WNko7WTDgrDV4,3394
|
6
|
+
dwani/docs.py,sha256=Cp0Gtudug79GH25toB-Npl35ZFA0TM32oZF2xH1VmNY,10598
|
7
|
+
dwani/exceptions.py,sha256=n06dPmR20rS4T3sJBWHQhGxzg4SJKzird9Hx0YTwwo0,226
|
8
|
+
dwani/translate.py,sha256=c03N8-tN49IBcTA6GMOkrJ3MaVzZ12RnYdLQwRbEeoQ,2794
|
9
|
+
dwani/vision.py,sha256=FviGewoV936CSv_K-latw0t3ZhSSCOF5LaGaq1oE4uA,3607
|
10
|
+
dwani-0.1.14.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
|
11
|
+
dwani-0.1.14.dist-info/METADATA,sha256=dHauJTsE8ujnm8Ak8QU0hJSiANxTjL6LoZIKZ3QPNCg,5543
|
12
|
+
dwani-0.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
dwani-0.1.14.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
|
14
|
+
dwani-0.1.14.dist-info/RECORD,,
|
dwani-0.1.12.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
dwani/__init__.py,sha256=8Q1qdF0g6xWEy1_PK6qxG-EeZUp_QOwYBqNv_y6EyHI,3010
|
2
|
-
dwani/asr.py,sha256=BAdqivQd57NJZX1dSY-J6EFi8TDdyuhf_AyCPcQ0M7w,1719
|
3
|
-
dwani/audio.py,sha256=MWsIZazL91c2wa5AE1YY78l9RKaJwNFFHIajuwl43Jg,886
|
4
|
-
dwani/chat.py,sha256=Tui52XBhUyDyN2rOFoLme4oB0Q8fkD9_0tFDAnRzoaU,2979
|
5
|
-
dwani/client.py,sha256=VG7MFCF4yLAWyD037YcI3QTUMxRfJZrWTDK-JAurTnY,3356
|
6
|
-
dwani/docs.py,sha256=Cp0Gtudug79GH25toB-Npl35ZFA0TM32oZF2xH1VmNY,10598
|
7
|
-
dwani/exceptions.py,sha256=n06dPmR20rS4T3sJBWHQhGxzg4SJKzird9Hx0YTwwo0,226
|
8
|
-
dwani/translate.py,sha256=c03N8-tN49IBcTA6GMOkrJ3MaVzZ12RnYdLQwRbEeoQ,2794
|
9
|
-
dwani/vision.py,sha256=sjkudW2Jb_PEbRcoZy_S1Wno6K5icZz42pHcpD1FMGs,3607
|
10
|
-
dwani-0.1.12.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
|
11
|
-
dwani-0.1.12.dist-info/METADATA,sha256=aj_vKOlWgfznm_c_RqT82VYKl8FBia0CDQLbf40ZoJU,5791
|
12
|
-
dwani-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
-
dwani-0.1.12.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
|
14
|
-
dwani-0.1.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|