Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio import Interface, inputs
|
| 2 |
+
import requests
|
| 3 |
+
import json
|
| 4 |
+
|
| 5 |
+
interface = Interface()
|
| 6 |
+
|
| 7 |
+
@interface.input("text", type=str, placeholder="Enter some text")
|
| 8 |
+
def rephrase(text):
|
| 9 |
+
response = requests.post(
|
| 10 |
+
"https://api.respell.ai/v1/run",
|
| 11 |
+
headers={"Authorization": "Bearer 6438355a-133a-4ad6-9674-a4f9be050cf8",
|
| 12 |
+
"Accept": "application/json",
|
| 13 |
+
"Content-Type": "application/json"},
|
| 14 |
+
data=json.dumps({"spellId": "YOUR_SPELL_ID",
|
| 15 |
+
"inputs": {"input": text}})
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
result = response.json()["outputs"][0]["output"]
|
| 19 |
+
|
| 20 |
+
return result
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
interface.launch()
|