Skip to main content

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': 'ಡಾಕ್ಯುಮೆಂಟ್ನ ಸರಳ ಪಠ್ಯ ಪ್ರಾತಿನಿಧ್ಯವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆ, ಅದನ್ನು ಸ್ವಾಭಾವಿಕವಾಗಿ ಓದುವಂತೆಃ'}]}

Project details


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.11.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwani-0.1.11-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file dwani-0.1.11.tar.gz.

File metadata

  • Download URL: dwani-0.1.11.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for dwani-0.1.11.tar.gz
Algorithm Hash digest
SHA256 7898c5bc41ce78e3573968de02bb058f2ed3544dcc6c40554e18145be5a6e13e
MD5 9615df4cedb780def85c656bd025b295
BLAKE2b-256 5fddbcddde73fa63ae994878259729518bb47682d5a3364aa4f810aa27a316b2

See more details on using hashes here.

File details

Details for the file dwani-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: dwani-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for dwani-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d685b424cc9b53ceec2ebfc413c031d2070cd9d319088fd23ff7c1ab962c3d60
MD5 e4b2d2865897e34f728f91aee168e34e
BLAKE2b-256 04acdde878a9277f096852e5235c3199b2d14157d1f97474ea8952faaa529a63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page