Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
import requests | |
API_URL = "https://api-inference.huggingface.co/models/foxxy-hm/mt5-small-finetuned-wikilingua-en-vi" | |
headers = {"Authorization": "Bearer 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"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
examples = [ | |
["The Moon's orbit around Earth has"], | |
["The smooth Borealis basin in the Northern Hemisphere covers 40%"], | |
] | |
demo = gr.Interface( | |
fn=query, | |
inputs=gr.inputs.Textbox(lines=5, label="Input Text"), | |
outputs=gr.outputs.Textbox(label="Generated Text"), | |
examples=examples | |
) | |
demo.launch() |