Spaces:
Sleeping
Sleeping
File size: 686 Bytes
3d78cdc 5c34ad5 3d78cdc 1a36a53 5c34ad5 3d78cdc 5c34ad5 3d78cdc ade53b7 3d78cdc 5c34ad5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import requests
import os
API_URL = "https://api-inference.huggingface.co/models/atlasia/Terjman-Nano-MAX_LEN-512"
HF_TOKEN = os.environ['HF_TOKEN']
headers = {"Authorization": "Bearer "+ HF_TOKEN}
def respond(english_text):
payload = {
"inputs": english_text,
}
darija_translated_text = requests.post(API_URL, headers=headers, json=payload)
return darija_translated_text.json()[0]["generated_text"]
app = gr.Interface(fn=respond, inputs="text", outputs="text", title="Terjman-Nano π¨βπ» π", description="Translate English text to Moroccan Darija using our smallest model (77M) π€")
if __name__ == "__main__":
app.launch() |