Spaces:
Sleeping
Sleeping
fix: cors origin allow for ts & fix wait time for getting ehr
Browse files- interface.py +1 -0
- tts/tts.py +9 -1
interface.py
CHANGED
@@ -58,6 +58,7 @@ import time
|
|
58 |
# Function: View EHR details
|
59 |
def view_ehr_details(view):
|
60 |
try:
|
|
|
61 |
response = requests.get(f"{API_BASE_URL}/details")
|
62 |
response.raise_for_status()
|
63 |
ehr_data = response.json()
|
|
|
58 |
# Function: View EHR details
|
59 |
def view_ehr_details(view):
|
60 |
try:
|
61 |
+
time.sleep(2.5)
|
62 |
response = requests.get(f"{API_BASE_URL}/details")
|
63 |
response.raise_for_status()
|
64 |
ehr_data = response.json()
|
tts/tts.py
CHANGED
@@ -4,7 +4,7 @@ from pythainlp.tokenize import sent_tokenize
|
|
4 |
from pydantic import BaseModel , Field
|
5 |
import requests
|
6 |
from fastapi.responses import FileResponse
|
7 |
-
import
|
8 |
from dotenv import load_dotenv
|
9 |
import os
|
10 |
|
@@ -15,6 +15,14 @@ load_dotenv()
|
|
15 |
|
16 |
app = FastAPI()
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Pydantic model for input validation
|
19 |
class VoiceRequest(BaseModel):
|
20 |
text: str
|
|
|
4 |
from pydantic import BaseModel , Field
|
5 |
import requests
|
6 |
from fastapi.responses import FileResponse
|
7 |
+
from fastapi.middleware.cors import CORSMiddleware
|
8 |
from dotenv import load_dotenv
|
9 |
import os
|
10 |
|
|
|
15 |
|
16 |
app = FastAPI()
|
17 |
|
18 |
+
app.add_middleware(
|
19 |
+
CORSMiddleware,
|
20 |
+
allow_origins=["*"],
|
21 |
+
allow_credentials=True,
|
22 |
+
allow_methods=["*"],
|
23 |
+
allow_headers=["*"],
|
24 |
+
)
|
25 |
+
|
26 |
# Pydantic model for input validation
|
27 |
class VoiceRequest(BaseModel):
|
28 |
text: str
|