File size: 676 Bytes
bdc83cd
 
 
 
 
 
 
 
 
 
 
 
 
ffa268b
bdc83cd
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from gradio import Interface, inputs
import requests
import json

interface = Interface()

@interface.input("text", type=str, placeholder="Enter some text")
def rephrase(text):
    response = requests.post(
        "https://api.respell.ai/v1/run",
        headers={"Authorization": "Bearer 6438355a-133a-4ad6-9674-a4f9be050cf8",
                 "Accept": "application/json",
                 "Content-Type": "application/json"},
        data=json.dumps({"spellId": "d7nG5HU8tVLmI1AjlOrFR",
                        "inputs": {"input": text}})
    )

    result = response.json()["outputs"][0]["output"]
    
    return result

if __name__ == "__main__":
    interface.launch()