Spaces:
Sleeping
Sleeping
Gowtham M
commited on
Commit
•
e576d2e
1
Parent(s):
0ccab18
Update Space
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
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}"}
|
@@ -8,7 +9,11 @@ headers = {"Authorization": f"Bearer {TK}"}
|
|
8 |
def get_output(text):
|
9 |
response = requests.post(API_URL, headers=headers, json={"inputs": text,"wait_for_model":True})
|
10 |
response = response.json()
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
return response[0]['generated_text']
|
13 |
|
14 |
description = """TRANSLITERATE is to represent or spell in the characters of another alphabet. Normally we create tamil words using English Characters
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
import os
|
4 |
+
import time
|
5 |
TK = os.environ['HF_TOKEN']
|
6 |
API_URL = "https://api-inference.huggingface.co/models/gowtham58/T_TL"
|
7 |
headers = {"Authorization": f"Bearer {TK}"}
|
|
|
9 |
def get_output(text):
|
10 |
response = requests.post(API_URL, headers=headers, json={"inputs": text,"wait_for_model":True})
|
11 |
response = response.json()
|
12 |
+
while type(response)==dict:
|
13 |
+
time.sleep(1)
|
14 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": text,"wait_for_model":True})
|
15 |
+
response = response.json()
|
16 |
+
|
17 |
return response[0]['generated_text']
|
18 |
|
19 |
description = """TRANSLITERATE is to represent or spell in the characters of another alphabet. Normally we create tamil words using English Characters
|