microhum commited on
Commit
b4525ce
Β·
1 Parent(s): 982f969

Init: huggingface space rest api

Browse files
Files changed (4) hide show
  1. DockerFile +6 -0
  2. README.md +14 -14
  3. llm/__pycache__/client.cpython-311.pyc +0 -0
  4. main.py +26 -0
DockerFile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ FROM python:3.10.9
2
+ COPY . .
3
+ WORKDIR /
4
+ RUN pip install --no-cache-dir --upgrade -r /requirements.txt
5
+
6
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,5 +1,7 @@
1
  # Nurse LLM
2
 
 
 
3
  ```
4
  /your_path/MALI_Nurse/
5
  β”œβ”€β”€ cli.py
@@ -34,9 +36,9 @@
34
 
35
  Alternatively, you can use Poetry for dependency management:
36
 
37
- ```sh
38
- poetry install
39
- ```
40
  3. Set up your environment variables in a `.env` file:
41
 
42
  ```env
@@ -100,18 +102,16 @@ Once the CLI is running, you can use the following commands:
100
 
101
  - To start interacting with the nurse LLM:
102
 
103
- ```sh
104
- start
105
- ```
106
-
107
  - To display help information:
108
 
109
- ```sh
110
- help
111
- ```
112
-
113
  - To exit the CLI session:
114
 
115
- ```sh
116
- exit
117
- ```
 
1
  # Nurse LLM
2
 
3
+ > #### M.A.R.I.N: Medical Assistance for Record Inference and Nursing Translation
4
+
5
  ```
6
  /your_path/MALI_Nurse/
7
  β”œβ”€β”€ cli.py
 
36
 
37
  Alternatively, you can use Poetry for dependency management:
38
 
39
+ ```sh
40
+ poetry install
41
+ ```
42
  3. Set up your environment variables in a `.env` file:
43
 
44
  ```env
 
102
 
103
  - To start interacting with the nurse LLM:
104
 
105
+ ```sh
106
+ start
107
+ ```
 
108
  - To display help information:
109
 
110
+ ```sh
111
+ help
112
+ ```
 
113
  - To exit the CLI session:
114
 
115
+ ```sh
116
+ exit
117
+ ```
llm/__pycache__/client.cpython-311.pyc CHANGED
Binary files a/llm/__pycache__/client.cpython-311.pyc and b/llm/__pycache__/client.cpython-311.pyc differ
 
main.py CHANGED
@@ -1,6 +1,8 @@
1
  import uvicorn
2
  from llm.llm import VirtualNurseLLM
3
  from fastapi import FastAPI
 
 
4
  from pydantic import BaseModel
5
  import os
6
  import dotenv
@@ -22,9 +24,33 @@ nurse_llm = VirtualNurseLLM(
22
 
23
  app = FastAPI()
24
 
 
 
 
 
 
 
 
 
25
  class UserInput(BaseModel):
26
  user_input: str
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  @app.get("/history")
29
  def get_chat_history():
30
  return {"chat_history": nurse_llm.chat_history}
 
1
  import uvicorn
2
  from llm.llm import VirtualNurseLLM
3
  from fastapi import FastAPI
4
+ from fastapi.middleware.cors import CORSMiddleware
5
+ from fastapi.responses import HTMLResponse
6
  from pydantic import BaseModel
7
  import os
8
  import dotenv
 
24
 
25
  app = FastAPI()
26
 
27
+ app.add_middleware(
28
+ CORSMiddleware,
29
+ allow_origins=["*"],
30
+ allow_credentials=True,
31
+ allow_methods=["*"],
32
+ allow_headers=["*"],
33
+ )
34
+
35
  class UserInput(BaseModel):
36
  user_input: str
37
 
38
+ @app.get("/", response_class=HTMLResponse)
39
+ def read_index():
40
+ return """
41
+ <!DOCTYPE html>
42
+ <html>
43
+ <head>
44
+ <title>MALI_NURSE API/title>
45
+ </head>
46
+ <body>
47
+ <h1>Welcome to MALI_NURSE API</h1>
48
+ <p>This is the index page. Use the link below to access the API docs:</p>
49
+ <a href="/docs">Go to Swagger Docs UI</a>
50
+ </body>
51
+ </html>
52
+ """
53
+
54
  @app.get("/history")
55
  def get_chat_history():
56
  return {"chat_history": nurse_llm.chat_history}