File size: 453 Bytes
09e95b9
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import streamlit as st
import requests

texte = st.text_input("Entrez un texte")

API_URL = "https://api-inference.huggingface.co/models/t5-large"
headers = {"Authorization": "xxxxxxxxxxxxxxxxxxxxxxx"}

if texte:
    def main(payload):
        response = requests.post(API_URL, headers=headers, json=payload)
        return response.json()
    output = main({"inputs": texte})
    st.write("**TRADUCTION** is : {}".format(output[0]["translation_text"]))