Spaces:
Runtime error
Runtime error
import gradio as gr | |
import requests | |
import json | |
def get_spell_correction(input_text): | |
response = requests.post( | |
"https://api.respell.ai/v1/run", | |
headers={ | |
"Authorization": "Bearer 260cee54-6d54-48ba-92e8-bf641b5f4805", | |
"Accept": "application/json", | |
"Content-Type": "application/json" | |
}, | |
data=json.dumps({ | |
"spellId": "1th5Ic7ZnMmZXBtZCfR7-", | |
# This field can be omitted to run the latest published version | |
"spellVersionId": "-NTOo8UsyhC-3g52p7ExZ", | |
# Fill in a value for your dynamic input block | |
"inputs": { | |
"pregunta": input_text, | |
} | |
}), | |
) | |
return response.json()["results"]["corrections"]["pregunta"]["text"] | |
iface = gr.Interface( | |
fn=get_spell_correction, | |
inputs="text", | |
outputs="text", | |
title="Respell Spell Checker", | |
description="Correct spelling using the Respell API.", | |
example="Enter your text here...", | |
) | |
iface.launch() | |