-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
49 lines (33 loc) · 1.17 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from typing import Union
from fastapi import FastAPI, Request, Depends
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from api_calls.get_illness_info import get_illness_info
from api_calls.get_illness_treatment_plan import get_illness_treatment_plan
from dotenv import load_dotenv
import os
load_dotenv()
app = FastAPI()
# Konfiguracja CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Pozwala na żądania ze wszystkich domen. Zmień na listę domen, jeśli chcesz to ograniczyć.
allow_credentials=True,
allow_methods=["*"], # Pozwala na wszystkie metody (GET, POST, PUT, DELETE itd.)
allow_headers=["*"], # Pozwala na wszystkie nagłówki
)
# Model danych
# class Choroba(BaseModel):
# choroba_name: str
class P(BaseModel):
difficulty: str
length: str
@app.get('/')
def test():
return {"message": "Odpowiedz z Backend"}
@app.get('/illness_more_info')
def illness_info(is_doctor: bool, length: int, disease: str):
return get_illness_info(is_doctor, length, disease)
@app.get('/illness_treatment_plan')
def illness_treatment_plan(disease: str):
return get_illness_treatment_plan(disease)