Gowtham M
Update Space
e576d2e
import gradio as gr
import requests
import os
import time
TK = os.environ['HF_TOKEN']
API_URL = "https://api-inference.huggingface.co/models/gowtham58/T_TL"
headers = {"Authorization": f"Bearer {TK}"}
def get_output(text):
response = requests.post(API_URL, headers=headers, json={"inputs": text,"wait_for_model":True})
response = response.json()
while type(response)==dict:
time.sleep(1)
response = requests.post(API_URL, headers=headers, json={"inputs": text,"wait_for_model":True})
response = response.json()
return response[0]['generated_text']
description = """TRANSLITERATE is to represent or spell in the characters of another alphabet. Normally we create tamil words using English Characters
in our daily text conversations. This Model can generate the words in tamil given a transliterated tamil word in english"""
css = """
h1 {
text-align: center;
display:block;
}
p {
text-align: center;
display:block;
}
.contain {
max-width: 900px;
margin: auto;
padding-top: 1.5rem;
}
"""
app = gr.Interface(
fn=get_output,
inputs="textbox",
outputs="text",
title="Tamil Transliteraion",
description=description,
examples=[["Hello, Nanba epdi iruka"], ["Naa Ready dha varava"]],
css = css,
allow_flagging="never",
)
app.launch()