language-demo / app.py
sheonhan's picture
remove share=True
97e52ab
raw
history blame
671 Bytes
import requests
import os
import gradio as gr
title = "Translate Text"
description = """"""
article = "Check out [the original repo](https://huggingface.co/language-tools/language-translation) that this demo is based off of."
API_URL = "https://api-inference.huggingface.co/models/t5-base"
ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN")
headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}
def query(payload):
response = requests.post(API_URL, headers=headers, json={"inputs": payload})
return response.json()
gr.Interface(
fn=query,
inputs="textbox",
outputs="text",
title=title,
description=description,
article=article
).launch()