Spaces:
Runtime error
Runtime error
Download app.py from mpolanco/simple-chatbot: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/mpolanco/simple-chatbot/resolve/main/app.py
- Command line
-
hf download hf://spaces/mpolanco/simple-chatbot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mpolanco/simple-chatbot/resolve/main/app.py
1.03 kB
| 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() | |