Spaces:
Sleeping
Sleeping
Gowtham M
commited on
Commit
•
d92c1fd
1
Parent(s):
dcd8b64
Update Space
Browse files
app.py
CHANGED
@@ -1,11 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
def
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
description = """TRANSLITERATE is to represent or spell in the characters of another alphabet. Normally we create tamil words using English Characters
|
11 |
in our daily text conversations. This Model can generate the words in tamil given a transliterated tamil word in english"""
|
@@ -13,26 +21,26 @@ css = """
|
|
13 |
h1 {
|
14 |
text-align: center;
|
15 |
display:block;
|
16 |
-
font-size:50px
|
17 |
}
|
18 |
p {
|
19 |
text-align: center;
|
20 |
display:block;
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
"""
|
25 |
|
26 |
gr.Interface(
|
27 |
-
fn=
|
28 |
inputs="textbox",
|
29 |
outputs="text",
|
30 |
title="Tamil Transliteraion",
|
31 |
description=description,
|
32 |
-
examples=[["
|
33 |
css = css,
|
34 |
allow_flagging="never",
|
35 |
).launch()
|
36 |
-
|
37 |
-
#demo.launch()
|
38 |
-
#gr.load("models/gowtham58/T_TL", alias="Tamil Transliteration").launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import requests
|
3 |
+
import os
|
4 |
+
TK = os.environ['HF_TOKEN']
|
5 |
+
API_URL = "https://api-inference.huggingface.co/models/gowtham58/T_TL"
|
6 |
+
headers = {"Authorization": f"Bearer {TK}"}
|
7 |
|
8 |
+
def get_output(text):
|
9 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": text,})
|
10 |
+
response = response.json()
|
11 |
+
#print(response)
|
12 |
+
while response[0]=='error':
|
13 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": text,})
|
14 |
+
response = response.json()
|
15 |
+
|
16 |
+
return response[0]['generated_text']
|
17 |
|
18 |
description = """TRANSLITERATE is to represent or spell in the characters of another alphabet. Normally we create tamil words using English Characters
|
19 |
in our daily text conversations. This Model can generate the words in tamil given a transliterated tamil word in english"""
|
|
|
21 |
h1 {
|
22 |
text-align: center;
|
23 |
display:block;
|
|
|
24 |
}
|
25 |
p {
|
26 |
text-align: center;
|
27 |
display:block;
|
28 |
+
}
|
29 |
+
.contain {
|
30 |
+
max-width: 900px;
|
31 |
+
margin: auto;
|
32 |
+
padding-top: 1.5rem;
|
33 |
}
|
34 |
|
35 |
"""
|
36 |
|
37 |
gr.Interface(
|
38 |
+
fn=get_output,
|
39 |
inputs="textbox",
|
40 |
outputs="text",
|
41 |
title="Tamil Transliteraion",
|
42 |
description=description,
|
43 |
+
examples=[["Hello, Nanba epdi iruka"], ["Naa Ready dha varava"]],
|
44 |
css = css,
|
45 |
allow_flagging="never",
|
46 |
).launch()
|
|
|
|
|
|