Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import concurrent
|
|
| 6 |
client = Client("abidlabs/en2fr")
|
| 7 |
inputs = ["Hello", "Bonjour", "Hola", "Guten Tag", "Ciao"]
|
| 8 |
|
| 9 |
-
|
| 10 |
def fetch_result(i):
|
| 11 |
start = time.time()
|
| 12 |
job = client.submit(i, api_name="/predict")
|
|
@@ -16,6 +16,7 @@ def fetch_result(i):
|
|
| 16 |
return result, duration
|
| 17 |
|
| 18 |
def ens2frs(ens):
|
|
|
|
| 19 |
en = ens.split("\n")
|
| 20 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
| 21 |
results = list(executor.map(fetch_result, en))
|
|
|
|
| 6 |
client = Client("abidlabs/en2fr")
|
| 7 |
inputs = ["Hello", "Bonjour", "Hola", "Guten Tag", "Ciao"]
|
| 8 |
|
| 9 |
+
|
| 10 |
def fetch_result(i):
|
| 11 |
start = time.time()
|
| 12 |
job = client.submit(i, api_name="/predict")
|
|
|
|
| 16 |
return result, duration
|
| 17 |
|
| 18 |
def ens2frs(ens):
|
| 19 |
+
start_total = time.time()
|
| 20 |
en = ens.split("\n")
|
| 21 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
| 22 |
results = list(executor.map(fetch_result, en))
|