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
    • Supported models : gemma3 (default), qwen3

  • gemma3
resp = dwani.Chat.create(prompt="Hello!", src_lang="english", tgt_lang="kannada", model="gemma3")
print(resp)
{'response': 'ನಮಸ್ತೆ! ಭಾರತ ಮತ್ತು ಕರ್ನಾಟಕವನ್ನು ಗಮನದಲ್ಲಿಟ್ಟುಕೊಂಡು ಇಂದು ನಿಮ್ಮ ಪ್ರಶ್ನೆಗಳಿಗೆ ನಾನು ನಿಮಗೆ ಹೇಗೆ ಸಹಾಯ ಮಾಡಲಿ?'}

Vision Query


  • With model selection
    • Supported models : gemma3 (default), moondream
  • gemma3
result = dwani.Vision.caption(
    file_path="image.png",
    query="Describe this logo",
    src_lang="english",
    tgt_lang="kannada",
    model="gemma3"
)
print(result)
{'answer': 'ಒಂದು ವಾಕ್ಯದಲ್ಲಿ ಚಿತ್ರದ ಸಾರಾಂಶವನ್ನು ಇಲ್ಲಿ ನೀಡಲಾಗಿದೆಃ ಪ್ರಕಟಣೆಯ ಅವಲೋಕನವು ಪ್ರಸ್ತುತ ಅರವತ್ತನಾಲ್ಕು ದೇಶಗಳು/ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಮತ್ತು ಇನ್ನೂ ಹದಿನಾರು ಪ್ರದೇಶಗಳನ್ನು ಸೇರಿಸಬೇಕಾಗಿದೆ. ಒದಗಿಸಲಾದ ಚಿತ್ರದಲ್ಲಿ ಲಾಂಛನವು ಕಾಣಿಸುವುದಿಲ್ಲ.'}

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.9.tar.gz (9.9 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.9-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dwani-0.1.9.tar.gz
  • Upload date:
  • Size: 9.9 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.9.tar.gz
Algorithm Hash digest
SHA256 a4675375bcb88c31aa93a295bca727f7f226f6a09ba4813d5d97d78b9653652d
MD5 7dd5d986be7a7fd0dadc26d85beb7488
BLAKE2b-256 5c6261fbdbb9d1ad27cf9f754675065351d68d4a47671cc41f95eb16d0356892

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dwani-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b74c69c5f6839b36fff5a6eaa2a07a8e9afd9c9946772c788d405953584dcd
MD5 0c02efcdf3f567010993598aeafa9532
BLAKE2b-256 65dee6361e3d4da6112cea78a8505673f4cc125941c3139471f239112996c9a9

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