Spaces:
Running
Running
Update apis/chat_api.py
Browse files- apis/chat_api.py +9 -0
apis/chat_api.py
CHANGED
|
@@ -18,6 +18,7 @@ from messagers.message_composer import MessageComposer
|
|
| 18 |
from googletrans import Translator
|
| 19 |
from io import BytesIO
|
| 20 |
from gtts import gTTS
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
class ChatAPIApp:
|
|
@@ -174,6 +175,14 @@ class ArgParser(argparse.ArgumentParser):
|
|
| 174 |
|
| 175 |
app = ChatAPIApp().app
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
if __name__ == "__main__":
|
| 178 |
args = ArgParser().args
|
| 179 |
if args.dev:
|
|
|
|
| 18 |
from googletrans import Translator
|
| 19 |
from io import BytesIO
|
| 20 |
from gtts import gTTS
|
| 21 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 22 |
|
| 23 |
|
| 24 |
class ChatAPIApp:
|
|
|
|
| 175 |
|
| 176 |
app = ChatAPIApp().app
|
| 177 |
|
| 178 |
+
app.add_middleware(
|
| 179 |
+
CORSMiddleware,
|
| 180 |
+
allow_origins=["*"],
|
| 181 |
+
allow_credentials=True,
|
| 182 |
+
allow_methods=["*"],
|
| 183 |
+
allow_headers=["*"],
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
if __name__ == "__main__":
|
| 187 |
args = ArgParser().args
|
| 188 |
if args.dev:
|