Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)
Project description
dwani.ai - python library
Install the library
pip install --upgrade dwani
Languages supported
- Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
Setup the credentials
import dwani
import os
dwani.api_key = os.getenv("DWANI_API_KEY")
dwani.api_base = os.getenv("DWANI_API_BASE_URL")
Text Query
- With model selection
- gemma3 (default), qwen3, sarvam-m
- gemma3 - with translation
resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
print(resp)
{'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}
- gemma3 - without translation
resp = dwani.Chat.direct(prompt="Hello!", model="gemma3")
print(resp)
{'response': 'Hello! I am Dwani, ready to assist you with information pertaining to India, specifically Karnataka. '}
Vision Query
-
With model selection
- gemma3 (default), moondream, smolvla
-
gemma3 - with translation
result = dwani.Vision.caption(
file_path="image.png",
query="Describe this logo",
src_lang="english",
tgt_lang="kannada",
model="gemma3"
)
print(result)
{'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}
- gemma3 - without translation
result = dwani.Vision.caption_direct(
file_path="image.png",
query="Describe this logo",
model="gemma3"
)
print(result)
{'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.'}
Speech to Text - Automatic Speech Recognition (ASR)
result = dwani.ASR.transcribe(file_path="kannada_sample.wav", language="kannada")
print(result)
{'text': 'ಕರ್ನಾಟಕ ದ ರಾಜಧಾನಿ ಯಾವುದು'}
Translate
resp = dwani.Translate.run_translate(sentences="hi, i am gaganyatri", src_lang="english", tgt_lang="kannada")
print(resp)
{'translations': ['ಹಾಯ್, ನಾನು ಗಗನಯಾತ್ರಿ']}
Text to Speech - Speech Synthesis
response = dwani.Audio.speech(input="ಕರ್ನಾಟಕದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="wav")
with open("output.wav", "wb") as f:
f.write(response)
Document - Extract Text
result = dwani.Documents.run_extract(file_path = "dwani-workshop.pdf", page_number=1, src_lang="english",tgt_lang="kannada" )
print(result)
{'pages': [{'processed_page': 1, 'page_content': ' a plain text representation of the document', 'translated_content': 'ಡಾಕ್ಯುಮೆಂಟ್ನ ಸರಳ ಪಠ್ಯ ಪ್ರಾತಿನಿಧ್ಯವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆ, ಅದನ್ನು ಸ್ವಾಭಾವಿಕವಾಗಿ ಓದುವಂತೆಃ'}]}
- Website -> dwani.ai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dwani-0.1.13.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dwani-0.1.13-py3-none-any.whl
(13.4 kB
view details)
File details
Details for the file dwani-0.1.13.tar.gz.
File metadata
- Download URL: dwani-0.1.13.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a12d0ff492ebd9141c388f6faa8d95242378bdd371d0389468fef40866e05ba9
|
|
| MD5 |
85da30258589d605e2445c7a5fc60740
|
|
| BLAKE2b-256 |
b7b4998764cffb017d88a84b1747429424cc793b037327d7a1a5e4764526e760
|
File details
Details for the file dwani-0.1.13-py3-none-any.whl.
File metadata
- Download URL: dwani-0.1.13-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf226967feb84876197f7c1aeeea4b3601cadeae013c9c92a666218e7971ed19
|
|
| MD5 |
6cb72db04dfdb85db3baf7c98f68bcfd
|
|
| BLAKE2b-256 |
856417ae36ac49d6c624a038e00368980419626c3d802ec0f9962552a4017543
|