Spaces:
Sleeping
Sleeping
File size: 1,298 Bytes
8549fc8 d92c1fd e576d2e d92c1fd 18fd7e3 d92c1fd 0ccab18 d92c1fd e576d2e d92c1fd 18fd7e3 d92c1fd 18fd7e3 542c148 d92c1fd 18fd7e3 d92c1fd 18fd7e3 542c148 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
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()
|