Spaces:
Runtime error
Runtime error
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() | |