Spaces:
Runtime error
Runtime error
File size: 681 Bytes
3fdd037 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |