Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,34 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
|
|
3 |
|
4 |
-
def
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
return response.json()["
|
23 |
|
24 |
iface = gr.Interface(
|
25 |
-
fn=
|
26 |
inputs="text",
|
27 |
outputs="text",
|
28 |
-
title="
|
29 |
-
description="
|
30 |
-
example="
|
31 |
)
|
32 |
|
33 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
+
import json
|
4 |
|
5 |
+
def get_spell_correction(input_text):
|
6 |
+
response = requests.post(
|
7 |
+
"https://api.respell.ai/v1/run",
|
8 |
+
headers={
|
9 |
+
"Authorization": "Bearer 260cee54-6d54-48ba-92e8-bf641b5f4805",
|
10 |
+
"Accept": "application/json",
|
11 |
+
"Content-Type": "application/json"
|
12 |
+
},
|
13 |
+
data=json.dumps({
|
14 |
+
"spellId": "1th5Ic7ZnMmZXBtZCfR7-",
|
15 |
+
# This field can be omitted to run the latest published version
|
16 |
+
"spellVersionId": "-NTOo8UsyhC-3g52p7ExZ",
|
17 |
+
# Fill in a value for your dynamic input block
|
18 |
+
"inputs": {
|
19 |
+
"pregunta": input_text,
|
20 |
+
}
|
21 |
+
}),
|
22 |
+
)
|
23 |
+
return response.json()["results"]["corrections"]["pregunta"]["text"]
|
24 |
|
25 |
iface = gr.Interface(
|
26 |
+
fn=get_spell_correction,
|
27 |
inputs="text",
|
28 |
outputs="text",
|
29 |
+
title="Respell Spell Checker",
|
30 |
+
description="Correct spelling using the Respell API.",
|
31 |
+
example="Enter your text here...",
|
32 |
)
|
33 |
|
34 |
iface.launch()
|