dwani 0.1.9__py3-none-any.whl → 0.1.11__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 +8 -2
- dwani/asr.py +5 -3
- dwani/audio.py +2 -2
- dwani/chat.py +33 -12
- dwani/client.py +11 -2
- dwani/docs.py +17 -7
- dwani/exceptions.py +1 -1
- dwani/translate.py +4 -3
- dwani/vision.py +33 -5
- {dwani-0.1.9.dist-info → dwani-0.1.11.dist-info}/METADATA +30 -7
- dwani-0.1.11.dist-info/RECORD +14 -0
- dwani-0.1.9.dist-info/RECORD +0 -14
- {dwani-0.1.9.dist-info → dwani-0.1.11.dist-info}/WHEEL +0 -0
- {dwani-0.1.9.dist-info → dwani-0.1.11.dist-info}/licenses/LICENSE +0 -0
- {dwani-0.1.9.dist-info → dwani-0.1.11.dist-info}/top_level.txt +0 -0
dwani/__init__.py
CHANGED
@@ -4,10 +4,10 @@ from .audio import Audio
|
|
4
4
|
from .vision import Vision
|
5
5
|
from .asr import ASR
|
6
6
|
from .translate import Translate
|
7
|
-
from .exceptions import
|
7
|
+
from .exceptions import DwaniAPIError
|
8
8
|
from .docs import Documents
|
9
9
|
|
10
|
-
__all__ = ["DwaniClient", "Chat", "Audio", "Vision", "ASR", "
|
10
|
+
__all__ = ["DwaniClient", "Chat", "Audio", "Vision", "ASR", "DwaniAPIError", "Translate", "Documents"]
|
11
11
|
|
12
12
|
# Optionally, instantiate a default client for convenience
|
13
13
|
api_key = None
|
@@ -24,6 +24,9 @@ class chat:
|
|
24
24
|
@staticmethod
|
25
25
|
def create(prompt, src_lang, tgt_lang, model="gemma3"):
|
26
26
|
return _get_client().chat(prompt, src_lang, tgt_lang, model)
|
27
|
+
@staticmethod
|
28
|
+
def direct(prompt, model="gemma3", system_prompt =""):
|
29
|
+
return _get_client().chat_direct(prompt, model, system_prompt)
|
27
30
|
|
28
31
|
class audio:
|
29
32
|
@staticmethod
|
@@ -34,6 +37,9 @@ class vision:
|
|
34
37
|
@staticmethod
|
35
38
|
def caption(file_path, query="describe the image", src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
|
36
39
|
return _get_client().caption(file_path, query, src_lang, tgt_lang, model)
|
40
|
+
@staticmethod
|
41
|
+
def caption_direct(file_path, query="describe the image", model="gemma3", system_prompt=""):
|
42
|
+
return _get_client().caption_direct(file_path, query, model, system_prompt)
|
37
43
|
|
38
44
|
class asr:
|
39
45
|
@staticmethod
|
dwani/asr.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .exceptions import
|
1
|
+
from .exceptions import DwaniAPIError
|
2
2
|
import requests
|
3
3
|
|
4
4
|
# Allowed languages (case-sensitive for display, but we'll handle case-insensitively)
|
@@ -13,7 +13,9 @@ ALLOWED_LANGUAGES = [
|
|
13
13
|
"Odia",
|
14
14
|
"Punjabi",
|
15
15
|
"Tamil",
|
16
|
-
"Telugu"
|
16
|
+
"Telugu",
|
17
|
+
"English",
|
18
|
+
"German"
|
17
19
|
]
|
18
20
|
|
19
21
|
def validate_language(language):
|
@@ -43,7 +45,7 @@ def asr_transcribe(client, file_path, language):
|
|
43
45
|
files=files
|
44
46
|
)
|
45
47
|
if resp.status_code != 200:
|
46
|
-
raise
|
48
|
+
raise DwaniAPIError(resp)
|
47
49
|
return resp.json()
|
48
50
|
|
49
51
|
class ASR:
|
dwani/audio.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .exceptions import
|
1
|
+
from .exceptions import DwaniAPIError
|
2
2
|
import requests
|
3
3
|
|
4
4
|
def audio_speech(client, input, response_format="mp3", output_file=None):
|
@@ -14,7 +14,7 @@ def audio_speech(client, input, response_format="mp3", output_file=None):
|
|
14
14
|
stream=True
|
15
15
|
)
|
16
16
|
if resp.status_code != 200:
|
17
|
-
raise
|
17
|
+
raise DwaniAPIError(resp)
|
18
18
|
if output_file:
|
19
19
|
with open(output_file, "wb") as f:
|
20
20
|
for chunk in resp.iter_content(chunk_size=8192):
|
dwani/chat.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .exceptions import
|
1
|
+
from .exceptions import DwaniAPIError
|
2
2
|
import requests
|
3
3
|
|
4
4
|
# Language options mapping
|
@@ -7,14 +7,15 @@ language_options = [
|
|
7
7
|
("Kannada", "kan_Knda"),
|
8
8
|
("Hindi", "hin_Deva"),
|
9
9
|
("Assamese", "asm_Beng"),
|
10
|
-
("Bengali",
|
11
|
-
("Gujarati",
|
12
|
-
("Malayalam",
|
13
|
-
("Marathi",
|
14
|
-
("Odia",
|
15
|
-
("Punjabi",
|
16
|
-
("Tamil",
|
17
|
-
("Telugu",
|
10
|
+
("Bengali","ben_Beng"),
|
11
|
+
("Gujarati","guj_Gujr"),
|
12
|
+
("Malayalam","mal_Mlym"),
|
13
|
+
("Marathi","mar_Deva"),
|
14
|
+
("Odia","ory_Orya"),
|
15
|
+
("Punjabi","pan_Guru"),
|
16
|
+
("Tamil","tam_Taml"),
|
17
|
+
("Telugu","tel_Telu"),
|
18
|
+
("German","deu_Latn"),
|
18
19
|
]
|
19
20
|
|
20
21
|
# Create a dictionary for language name to code mapping
|
@@ -35,9 +36,25 @@ def normalize_language(lang):
|
|
35
36
|
supported_langs = list(lang_name_to_code.keys()) + list(lang_code_to_code.keys())
|
36
37
|
raise ValueError(f"Unsupported language: {lang}. Supported languages: {supported_langs}")
|
37
38
|
|
39
|
+
def chat_direct(client, prompt, model="gemma3", system_prompt=""):
|
40
|
+
url = f"{client.api_base}/v1/chat_direct"
|
41
|
+
payload = {
|
42
|
+
"prompt": prompt,
|
43
|
+
"model": model,
|
44
|
+
"system_prompt":system_prompt
|
45
|
+
}
|
46
|
+
resp = requests.post(
|
47
|
+
url,
|
48
|
+
headers={**client._headers(), "Content-Type": "application/json"},
|
49
|
+
json=payload
|
50
|
+
)
|
51
|
+
if resp.status_code != 200:
|
52
|
+
raise DwaniAPIError(resp)
|
53
|
+
return resp.json()
|
54
|
+
|
38
55
|
def chat_create(client, prompt, src_lang, tgt_lang, model="gemma3"):
|
39
56
|
# Validate model
|
40
|
-
valid_models = ["gemma3", "qwen3", "deepseek-r1"]
|
57
|
+
valid_models = ["gemma3", "qwen3", "deepseek-r1", "sarvam-m"]
|
41
58
|
if model not in valid_models:
|
42
59
|
raise ValueError(f"Unsupported model: {model}. Supported models: {valid_models}")
|
43
60
|
|
@@ -58,11 +75,15 @@ def chat_create(client, prompt, src_lang, tgt_lang, model="gemma3"):
|
|
58
75
|
json=payload
|
59
76
|
)
|
60
77
|
if resp.status_code != 200:
|
61
|
-
raise
|
78
|
+
raise DwaniAPIError(resp)
|
62
79
|
return resp.json()
|
63
80
|
|
64
81
|
class Chat:
|
65
82
|
@staticmethod
|
66
83
|
def create(prompt, src_lang, tgt_lang, model="gemma3"):
|
67
84
|
from . import _get_client
|
68
|
-
return _get_client().chat(prompt, src_lang, tgt_lang, model)
|
85
|
+
return _get_client().chat(prompt, src_lang, tgt_lang, model)
|
86
|
+
@staticmethod
|
87
|
+
def direct(prompt, model="gemma3", system_prompt=""):
|
88
|
+
from . import _get_client
|
89
|
+
return _get_client().chat_direct(prompt, model, system_prompt)
|
dwani/client.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import requests
|
3
|
-
from .exceptions import
|
3
|
+
from .exceptions import DwaniAPIError
|
4
4
|
|
5
5
|
class DwaniClient:
|
6
6
|
def __init__(self, api_key=None, api_base=None):
|
@@ -22,7 +22,12 @@ class DwaniClient:
|
|
22
22
|
def chat(self, prompt, src_lang, tgt_lang, model="gemma3"):
|
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
|
+
def chat_direct(self, prompt, model="gemma3", system_prompt=""):
|
28
|
+
from .chat import chat_direct
|
29
|
+
return chat_direct(self, prompt=prompt, model=model, system_prompt=system_prompt)
|
30
|
+
|
26
31
|
def speech(self, input, response_format="mp3"):
|
27
32
|
from .audio import audio_speech
|
28
33
|
return audio_speech(self, input=input, response_format=response_format)
|
@@ -31,6 +36,10 @@ class DwaniClient:
|
|
31
36
|
from .vision import vision_caption
|
32
37
|
return vision_caption(self, file_path=file_path, query=query, src_lang=src_lang, tgt_lang=tgt_lang, model=model)
|
33
38
|
|
39
|
+
def caption_direct(self, file_path, query="describe the image", model="gemma3", system_prompt=""):
|
40
|
+
from .vision import vision_direct
|
41
|
+
return vision_direct(self, file_path=file_path, query=query, model=model, system_prompt=system_prompt)
|
42
|
+
|
34
43
|
def transcribe(self, file_path, language=None):
|
35
44
|
from .asr import asr_transcribe
|
36
45
|
return asr_transcribe(self, file_path=file_path, language=language)
|
dwani/docs.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import requests
|
2
|
-
|
2
|
+
|
3
|
+
from .exceptions import DwaniAPIError
|
3
4
|
import logging
|
4
5
|
|
5
6
|
# Set up logging
|
@@ -11,7 +12,8 @@ language_options = [
|
|
11
12
|
("Kannada", "kan_Knda"),
|
12
13
|
("Hindi", "hin_Deva"),
|
13
14
|
("Tamil", "tam_Taml"),
|
14
|
-
("Telugu", "tel_Telu")
|
15
|
+
("Telugu", "tel_Telu"),
|
16
|
+
("German", "deu_Latn")
|
15
17
|
]
|
16
18
|
|
17
19
|
# Create dictionaries for language name to code and code to code mapping
|
@@ -61,7 +63,7 @@ def document_ocr(client, file_path, language=None, model="gemma3"):
|
|
61
63
|
resp.raise_for_status()
|
62
64
|
except requests.RequestException as e:
|
63
65
|
logger.error(f"OCR request failed: {str(e)}")
|
64
|
-
raise
|
66
|
+
raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
|
65
67
|
|
66
68
|
logger.debug(f"OCR response: {resp.status_code}")
|
67
69
|
return resp.json()
|
@@ -89,6 +91,7 @@ def document_summarize(client, file_path, page_number=1, src_lang="eng_Latn", tg
|
|
89
91
|
"tgt_lang": tgt_lang_code,
|
90
92
|
"model": model
|
91
93
|
}
|
94
|
+
|
92
95
|
try:
|
93
96
|
resp = requests.post(
|
94
97
|
url,
|
@@ -100,9 +103,10 @@ def document_summarize(client, file_path, page_number=1, src_lang="eng_Latn", tg
|
|
100
103
|
resp.raise_for_status()
|
101
104
|
except requests.RequestException as e:
|
102
105
|
logger.error(f"Summarize request failed: {str(e)}")
|
103
|
-
raise
|
106
|
+
raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
|
104
107
|
|
105
108
|
logger.debug(f"Summarize response: {resp.status_code}")
|
109
|
+
|
106
110
|
return resp.json()
|
107
111
|
|
108
112
|
def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
|
@@ -122,6 +126,7 @@ def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan
|
|
122
126
|
headers = client._headers()
|
123
127
|
with open(file_path, "rb") as f:
|
124
128
|
files = {"file": (file_path, f, "application/pdf")}
|
129
|
+
|
125
130
|
data = {
|
126
131
|
"page_number": str(page_number),
|
127
132
|
"src_lang": src_lang_code,
|
@@ -139,9 +144,10 @@ def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan
|
|
139
144
|
resp.raise_for_status()
|
140
145
|
except requests.RequestException as e:
|
141
146
|
logger.error(f"Extract request failed: {str(e)}")
|
142
|
-
raise
|
147
|
+
raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
|
143
148
|
|
144
149
|
logger.debug(f"Extract response: {resp.status_code}")
|
150
|
+
|
145
151
|
return resp.json()
|
146
152
|
|
147
153
|
def doc_query(
|
@@ -178,6 +184,7 @@ def doc_query(
|
|
178
184
|
"tgt_lang": tgt_lang_code,
|
179
185
|
"model": model
|
180
186
|
}
|
187
|
+
|
181
188
|
try:
|
182
189
|
resp = requests.post(
|
183
190
|
url,
|
@@ -189,9 +196,10 @@ def doc_query(
|
|
189
196
|
resp.raise_for_status()
|
190
197
|
except requests.RequestException as e:
|
191
198
|
logger.error(f"Doc query request failed: {str(e)}")
|
192
|
-
raise
|
199
|
+
raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
|
193
200
|
|
194
201
|
logger.debug(f"Doc query response: {resp.status_code}")
|
202
|
+
|
195
203
|
return resp.json()
|
196
204
|
|
197
205
|
def doc_query_kannada(
|
@@ -221,6 +229,7 @@ def doc_query_kannada(
|
|
221
229
|
headers = client._headers()
|
222
230
|
with open(file_path, "rb") as f:
|
223
231
|
files = {"file": (file_path, f, "application/pdf")}
|
232
|
+
|
224
233
|
data = {
|
225
234
|
"page_number": str(page_number),
|
226
235
|
"prompt": prompt,
|
@@ -239,9 +248,10 @@ def doc_query_kannada(
|
|
239
248
|
resp.raise_for_status()
|
240
249
|
except requests.RequestException as e:
|
241
250
|
logger.error(f"Doc query Kannada request failed: {str(e)}")
|
242
|
-
raise
|
251
|
+
raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
|
243
252
|
|
244
253
|
logger.debug(f"Doc query Kannada response: {resp.status_code}")
|
254
|
+
|
245
255
|
return resp.json()
|
246
256
|
|
247
257
|
class Documents:
|
dwani/exceptions.py
CHANGED
dwani/translate.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .exceptions import
|
1
|
+
from .exceptions import DwaniAPIError
|
2
2
|
import requests
|
3
3
|
|
4
4
|
# Language options mapping
|
@@ -14,7 +14,8 @@ language_options = [
|
|
14
14
|
("Odia", "ory_Orya"),
|
15
15
|
("Punjabi", "pan_Guru"),
|
16
16
|
("Tamil", "tam_Taml"),
|
17
|
-
("Telugu", "tel_Telu")
|
17
|
+
("Telugu", "tel_Telu"),
|
18
|
+
("German", "deu_Latn")
|
18
19
|
]
|
19
20
|
|
20
21
|
# Create dictionaries for language name to code and code to code mapping
|
@@ -62,7 +63,7 @@ def run_translate(client, sentences, src_lang, tgt_lang):
|
|
62
63
|
json=payload
|
63
64
|
)
|
64
65
|
if resp.status_code != 200:
|
65
|
-
raise
|
66
|
+
raise DwaniAPIError(resp)
|
66
67
|
return resp.json()
|
67
68
|
|
68
69
|
class Translate:
|
dwani/vision.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .exceptions import
|
1
|
+
from .exceptions import DwaniAPIError
|
2
2
|
import requests
|
3
3
|
|
4
4
|
# Language options mapping
|
@@ -14,7 +14,8 @@ language_options = [
|
|
14
14
|
("Odia", "ory_Orya"),
|
15
15
|
("Punjabi", "pan_Guru"),
|
16
16
|
("Tamil", "tam_Taml"),
|
17
|
-
("Telugu", "tel_Telu")
|
17
|
+
("Telugu", "tel_Telu"),
|
18
|
+
("German","deu_Latn")
|
18
19
|
]
|
19
20
|
|
20
21
|
# Create dictionaries for language name to code and code to code mapping
|
@@ -35,9 +36,32 @@ def normalize_language(lang):
|
|
35
36
|
supported_langs = list(lang_name_to_code.keys()) + list(lang_code_to_code.keys())
|
36
37
|
raise ValueError(f"Unsupported language: {lang}. Supported languages: {supported_langs}")
|
37
38
|
|
39
|
+
def vision_direct(client, file_path, query="describe this image", model="gemma3", system_prompt=""):
|
40
|
+
url = (
|
41
|
+
f"{client.api_base}/v1/visual_query_direct"
|
42
|
+
f"?model={model}"
|
43
|
+
)
|
44
|
+
headers = {
|
45
|
+
**client._headers(),
|
46
|
+
"accept": "application/json"
|
47
|
+
}
|
48
|
+
with open(file_path, "rb") as f:
|
49
|
+
files = {"file": (file_path, f, "image/png")}
|
50
|
+
data = {"query": query, "system_prompt": system_prompt}
|
51
|
+
resp = requests.post(
|
52
|
+
url,
|
53
|
+
headers=headers,
|
54
|
+
files=files,
|
55
|
+
data=data
|
56
|
+
)
|
57
|
+
if resp.status_code != 200:
|
58
|
+
raise DwaniAPIError(resp)
|
59
|
+
return resp.json()
|
60
|
+
|
61
|
+
|
38
62
|
def vision_caption(client, file_path, query="describe the image", src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
|
39
63
|
# Validate model
|
40
|
-
valid_models = ["gemma3", "qwen2.5vl", "moondream"]
|
64
|
+
valid_models = ["gemma3", "qwen2.5vl", "moondream", "smolvla"]
|
41
65
|
if model not in valid_models:
|
42
66
|
raise ValueError(f"Unsupported model: {model}. Supported models: {valid_models}")
|
43
67
|
|
@@ -64,11 +88,15 @@ def vision_caption(client, file_path, query="describe the image", src_lang="eng_
|
|
64
88
|
data=data
|
65
89
|
)
|
66
90
|
if resp.status_code != 200:
|
67
|
-
raise
|
91
|
+
raise DwaniAPIError(resp)
|
68
92
|
return resp.json()
|
69
93
|
|
70
94
|
class Vision:
|
71
95
|
@staticmethod
|
72
96
|
def caption(file_path, query="describe the image", src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
|
73
97
|
from . import _get_client
|
74
|
-
return _get_client().caption(file_path, query, src_lang, tgt_lang, model)
|
98
|
+
return _get_client().caption(file_path, query, src_lang, tgt_lang, model)
|
99
|
+
@staticmethod
|
100
|
+
def caption_direct(file_path, query="describe the image", model="gemma3", system_prompt=""):
|
101
|
+
from . import _get_client
|
102
|
+
return _get_client().caption_direct(file_path, query, model, system_prompt)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dwani
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11
|
4
4
|
Summary: Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)
|
5
5
|
Author-email: sachin <python@dwani.ai>
|
6
6
|
License: MIT License
|
@@ -59,10 +59,10 @@ dwani.api_base = os.getenv("DWANI_API_BASE_URL")
|
|
59
59
|
### Text Query
|
60
60
|
---
|
61
61
|
- With model selection
|
62
|
-
-
|
62
|
+
- gemma3 (default), qwen3, sarvam-m
|
63
63
|
|
64
64
|
---
|
65
|
-
- gemma3
|
65
|
+
- gemma3 - with translation
|
66
66
|
```python
|
67
67
|
resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
|
68
68
|
print(resp)
|
@@ -70,13 +70,23 @@ print(resp)
|
|
70
70
|
```json
|
71
71
|
{'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
|
72
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
|
+
|
73
83
|
---
|
74
84
|
### Vision Query
|
75
85
|
---
|
76
86
|
- With model selection
|
77
|
-
-
|
78
|
-
- gemma3
|
87
|
+
- gemma3 (default), moondream, smolvla
|
79
88
|
|
89
|
+
- gemma3 - with translation
|
80
90
|
```python
|
81
91
|
result = dwani.Vision.caption(
|
82
92
|
file_path="image.png",
|
@@ -90,6 +100,19 @@ print(result)
|
|
90
100
|
```json
|
91
101
|
{'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
|
92
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
|
+
|
93
116
|
---
|
94
117
|
### Speech to Text - Automatic Speech Recognition (ASR)
|
95
118
|
---
|
@@ -108,13 +131,13 @@ resp = dwani.Translate.run_translate(sentences="hi, i am gaganyatri", src_lang="
|
|
108
131
|
print(resp)
|
109
132
|
```
|
110
133
|
```json
|
111
|
-
{'translations': ['
|
134
|
+
{'translations': ['ಹಾಯ್, ನಾನು ಗಗನಯಾತ್ರಿ']}
|
112
135
|
```
|
113
136
|
---
|
114
137
|
### Text to Speech - Speech Synthesis
|
115
138
|
---
|
116
139
|
```python
|
117
|
-
response = dwani.Audio.speech(input="
|
140
|
+
response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav")
|
118
141
|
with open("output.wav", "wb") as f:
|
119
142
|
f.write(response)
|
120
143
|
```
|
@@ -0,0 +1,14 @@
|
|
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=-6UHV5hu1oBxuDlGlGYp13bFDayKWwo1rBkJhE-LRMs,2568
|
9
|
+
dwani/vision.py,sha256=sjkudW2Jb_PEbRcoZy_S1Wno6K5icZz42pHcpD1FMGs,3607
|
10
|
+
dwani-0.1.11.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
|
11
|
+
dwani-0.1.11.dist-info/METADATA,sha256=6dhzLxq9g_unE9uqNFYwMGBXAB3WvjAMyDnvhYjkDqo,5791
|
12
|
+
dwani-0.1.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
dwani-0.1.11.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
|
14
|
+
dwani-0.1.11.dist-info/RECORD,,
|
dwani-0.1.9.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
dwani/__init__.py,sha256=JcbP7N6J-is-r5g5aDM8OluuCD1V5HxT3TgMtLwcH8s,2665
|
2
|
-
dwani/asr.py,sha256=3LYrLOaMhc5eXKFSoi63C8KAvwZI2NcuO25pwTfSVe0,1692
|
3
|
-
dwani/audio.py,sha256=Q9vw4uBxGy1vQzmiZjZGrY8hkAEQNkGhjz5OcnpFEQQ,888
|
4
|
-
dwani/chat.py,sha256=a6Bd0Skx9Fi4UVCj_-FfUR0wt3y8ep1AV7Q7kEqvpzA,2315
|
5
|
-
dwani/client.py,sha256=sDSA1F1Ixh08uaSf4tuzsOm72oEAUi9w3dUiP3fyvUk,2905
|
6
|
-
dwani/docs.py,sha256=PBCUHyulcV1AYX7WcX_uKLkYjUQ48zAZ9PK9Rrvhy6s,10571
|
7
|
-
dwani/exceptions.py,sha256=qEN5ukqlnN7v-kHNEnISWFMpPMt6uTft9mPsTXJ4LVA,227
|
8
|
-
dwani/translate.py,sha256=nYqKX7TDz6hds2Ih-CWXWkS8Bd_4KXVY_NG7erhtS_8,2542
|
9
|
-
dwani/vision.py,sha256=rfmcLFPdZC1MLdYAG3aRdCW22-gkXfjqm6WYZJ1Ac2k,2674
|
10
|
-
dwani-0.1.9.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
|
11
|
-
dwani-0.1.9.dist-info/METADATA,sha256=hjS9WvvbnDJ3IZQkkg7PV4sRnbyBJmrxD0kz5Q4TFuc,5045
|
12
|
-
dwani-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
-
dwani-0.1.9.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
|
14
|
-
dwani-0.1.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|