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 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")

Examples

Text Query

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

Vision Query

result = dwani.Vision.caption(
    file_path="image.png",
    query="Describe this logo",
    src_lang="eng_Latn",
    tgt_lang="kan_Knda"
)
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"], src_lang="eng_Latn", tgt_lang="kan_Knda")
print(resp)
{'translations': ['ಹಾಯ್']}

Text to Speech - Speech Synthesis

response = dwani.Audio.speech(input="ಕರ್ನಾಟಕ ದ ರಾಜಧಾನಿ ಯಾವುದು", response_format="mp3")
with open("output.mp3", "wb") as f:
    f.write(response)

Document - Extract Text

result = dwani.Documents.run_extract(file_path = "dwani-workshop.pdf", page_number=1, src_lang="eng_Latn",tgt_lang="kan_Knda" )
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.7.tar.gz (9.0 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.7-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dwani-0.1.7.tar.gz
  • Upload date:
  • Size: 9.0 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.7.tar.gz
Algorithm Hash digest
SHA256 e871c7f15760e3f794ad9653b6e87a54557f5a436bd05e4018798845a1f63f5c
MD5 414728a49b3d233b92e9edd735707706
BLAKE2b-256 354879bc200dca901e4fed8d55b82adb3547dacb06daa73db70f1b40dd2d8e19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dwani-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b4eb08721dc3a82d5b30b9774f179848c25a9f4fe9c9f1b7d8ba62a119310c85
MD5 5e7eef71a6cc9fec11f3b1a84a0c1444
BLAKE2b-256 cdc714d3b53005010b19ba85ae351e49aaf97be64081beb153981aeb7445bd9b

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