Spaces:
Runtime error
Runtime error
Commit
·
09e95b9
1
Parent(s):
e7f4f68
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import requests
|
3 |
+
|
4 |
+
texte = st.text_input("Entrez un texte")
|
5 |
+
|
6 |
+
API_URL = "https://api-inference.huggingface.co/models/t5-large"
|
7 |
+
headers = {"Authorization": "xxxxxxxxxxxxxxxxxxxxxxx"}
|
8 |
+
|
9 |
+
if texte:
|
10 |
+
def main(payload):
|
11 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
12 |
+
return response.json()
|
13 |
+
output = main({"inputs": texte})
|
14 |
+
st.write("**TRADUCTION** is : {}".format(output[0]["translation_text"]))
|