import gradio as gr import requests import os 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,}) response = response.json() #print(response) while response[0]=='error': response = requests.post(API_URL, headers=headers, json={"inputs": text,}) 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()