Spaces:
Runtime error
Runtime error
fix error message
Browse files
app.py
CHANGED
@@ -10,8 +10,15 @@ def respond(english_text):
|
|
10 |
payload = {
|
11 |
"inputs": english_text,
|
12 |
}
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
app = gr.Interface(fn=respond, inputs="text", outputs="text", title="Terjman-Large π¨βπ»π₯°", description="Translate English text to Moroccan Darija using our Large model (240M) π€")
|
17 |
|
|
|
10 |
payload = {
|
11 |
"inputs": english_text,
|
12 |
}
|
13 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
14 |
+
|
15 |
+
try:
|
16 |
+
output = response[0]['generated_text']
|
17 |
+
|
18 |
+
except KeyError:
|
19 |
+
output = f"Model is loading. Estimated time {output['estimated_time']}"
|
20 |
+
|
21 |
+
return output
|
22 |
|
23 |
app = gr.Interface(fn=respond, inputs="text", outputs="text", title="Terjman-Large π¨βπ»π₯°", description="Translate English text to Moroccan Darija using our Large model (240M) π€")
|
24 |
|