Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from loyal812/fix/readme
Browse files Browse the repository at this point in the history
Fix/readme
  • Loading branch information
eureka320 committed Mar 27, 2024
2 parents 5e76807 + 8e129fd commit 1105f57
Show file tree
Hide file tree
Showing 54 changed files with 266 additions and 271 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
OPENAI_API_KEY=
MATHPIX_APP_ID=
MATHPIX_APP_KEY=
Mongo_URI=
MongoDB_USERNAME=
MongoDB_PASSWORD=
MONGODB_CLUSTER_NAME=
137 changes: 136 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,139 @@ py .\check_api_key.py --payload_dir="./test/regression/regression_testxxx/payloa
"mongo_uri": "mongodb+srv://{user_name}:{password}@cluster0.ill5gnu.mongodb.net",
"db_name": "oridosai",
"collection_name": "apis"
}
}

### AWS EC2

- Launch Instance
![Alt text](./images/image.png)

- Instance Setting
![Alt text](./images/image-1.png)

![Alt text](./images/image-2.png)

![Alt text](./images/image-3.png)

![Alt text](./images/image-4.png)

![Alt text](./images/image-5.png)

- Elastic IP Setting
![Alt text](./images/image-7.png)

![Alt text](./images/image-8.png)

![Alt text](./images/image-9.png)

![Alt text](./images/image-10.png)

![Alt text](./images/image-11.png)

- Security Group Setting
![Alt text](./images/image-12.png)

![Alt text](./images/image-13.png)

![Alt text](./images/image-14.png)

![Alt text](./images/image-15.png)

- Connect to Instance
![Alt text](./images/image-16.png)

![Alt text](./images/image-17.png)

### Project Setting
```
sudo su
apt update
apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-cache policy docker-ce
apt install docker-ce
apt install docker-compose
apt install make
apt install nginx
cd /var/www
git clone https://github.com/oridosai/img2txt-fine-tuning-api.git
cd img2txt-fine-tuning-api
chmod -R 777 /var/www/img2txt-fine-tuning-api
nano .env
Please copy your local env data at this file and save.
OPENAI_API_KEY=
MATHPIX_APP_ID=
MATHPIX_APP_KEY=
MONGODB_USERNAME=
MONGODB_PASSWORD=
MONGODB_CLUSTER_NAME=
docker-compose up -d
```

### done
host your elastic ip

http://{your elastic ip}:5000/create_api
POST
```
{
"user": "",
"title": "",
"description": "",
"data_id": ""
}
```

http://{your elastic ip}:5000/delete_api
POST
```
{
"api_key": "",
"user": "",
"data_id": ""
}
```

http://{your elastic ip}:5000/check_api
POST
```
{
"api_key": "",
"user": "",
"data_id": ""
}
```

http://{your elastic ip}:5000/finetuning
POST
```
{
"api_key": "",
"user": "",
"data_id": ""
}
```

http://{your elastic ip}:5000/conversation
POST
```
{
"api_key": "",
"user": "",
"data_id": "",
"question": "hi"
}
```
13 changes: 1 addition & 12 deletions chatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import gc
import argparse
from pathlib import Path
from urllib.parse import quote_plus

from src.utils.read_json import read_json
from src.chatting.ChattingClass import ChattingClass
Expand All @@ -16,18 +15,8 @@ def chatting(args):
# Payload
payload_data = read_json(args.payload_dir)

# Your MongoDB Atlas connection details
mongodb_username = payload_data["mongodb_username"]
mongodb_password = payload_data["mongodb_password"]
mongodb_cluster_name = payload_data["mongodb_cluster_name"]
mongodb_database_name = payload_data["mongodb_database_name"]

# Escape the mongodb_username and mongodb_password
mongodb_escaped_username = quote_plus(mongodb_username)
mongodb_escaped_password = quote_plus(mongodb_password)

# Construct the MongoDB Atlas URI
mongo_uri = f"mongodb+srv://{mongodb_escaped_username}:{mongodb_escaped_password}@{mongodb_cluster_name}.mongodb.net/{mongodb_database_name}"
mongo_uri = payload_data["mongo_uri"]

# Call class instance
mongodb = MongoDBClass(
Expand Down
13 changes: 1 addition & 12 deletions check_api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gc
import argparse
from pathlib import Path
from urllib.parse import quote_plus

from src.utils.read_json import read_json
from src.mongodb.MongoDBClass import MongoDBClass
Expand All @@ -17,18 +16,8 @@ def check_api_key(args):
# Payload
payload_data = read_json(args.payload_dir)

# Your MongoDB Atlas connection details
mongodb_username = payload_data["mongodb_username"]
mongodb_password = payload_data["mongodb_password"]
mongodb_cluster_name = payload_data["mongodb_cluster_name"]
mongodb_database_name = payload_data["mongodb_database_name"]

# Escape the mongodb_username and mongodb_password
mongodb_escaped_username = quote_plus(mongodb_username)
mongodb_escaped_password = quote_plus(mongodb_password)

# Construct the MongoDB Atlas URI
mongo_uri = f"mongodb+srv://{mongodb_escaped_username}:{mongodb_escaped_password}@{mongodb_cluster_name}.mongodb.net/{mongodb_database_name}"
mongo_uri = payload_data["mongo_uri"]

# Call class instance
mongodb = MongoDBClass(
Expand Down
13 changes: 1 addition & 12 deletions create_api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import argparse
from pathlib import Path
from datetime import datetime
from urllib.parse import quote_plus

from src.utils.read_json import read_json
from src.mongodb.MongoDBClass import MongoDBClass
Expand All @@ -19,18 +18,8 @@ def create_api_key(args):
# Payload
payload_data = read_json(args.payload_dir)

# Your MongoDB Atlas connection details
mongodb_username = payload_data["mongodb_username"]
mongodb_password = payload_data["mongodb_password"]
mongodb_cluster_name = payload_data["mongodb_cluster_name"]
mongodb_database_name = payload_data["mongodb_database_name"]

# Escape the mongodb_username and mongodb_password
mongodb_escaped_username = quote_plus(mongodb_username)
mongodb_escaped_password = quote_plus(mongodb_password)

# Construct the MongoDB Atlas URI
mongo_uri = f"mongodb+srv://{mongodb_escaped_username}:{mongodb_escaped_password}@{mongodb_cluster_name}.mongodb.net/{mongodb_database_name}"
mongo_uri = payload_data["mongo_uri"]

# Call class instance
mongodb = MongoDBClass(
Expand Down
13 changes: 1 addition & 12 deletions delete_api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gc
import argparse
from pathlib import Path
from urllib.parse import quote_plus

from src.utils.read_json import read_json
from src.mongodb.MongoDBClass import MongoDBClass
Expand All @@ -16,18 +15,8 @@ def delete_api_key(args):
# Payload
payload_data = read_json(args.payload_dir)

# Your MongoDB Atlas connection details
mongodb_username = payload_data["mongodb_username"]
mongodb_password = payload_data["mongodb_password"]
mongodb_cluster_name = payload_data["mongodb_cluster_name"]
mongodb_database_name = payload_data["mongodb_database_name"]

# Escape the mongodb_username and mongodb_password
mongodb_escaped_username = quote_plus(mongodb_username)
mongodb_escaped_password = quote_plus(mongodb_password)

# Construct the MongoDB Atlas URI
mongo_uri = f"mongodb+srv://{mongodb_escaped_username}:{mongodb_escaped_password}@{mongodb_cluster_name}.mongodb.net/{mongodb_database_name}"
mongo_uri = payload_data["mongo_uri"]

# Call class instance
mongodb = MongoDBClass(
Expand Down
Binary file added images/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 1 addition & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time
import argparse
from pathlib import Path
from urllib.parse import quote_plus
import concurrent.futures
from datetime import datetime
import json
Expand All @@ -24,18 +23,8 @@ def total_process(args):

payload_data = read_json(args.payload_dir)

# Your MongoDB Atlas connection details
mongodb_username = payload_data["mongodb_username"]
mongodb_password = payload_data["mongodb_password"]
mongodb_cluster_name = payload_data["mongodb_cluster_name"]
mongodb_database_name = payload_data["mongodb_database_name"]

# Escape the mongodb_username and mongodb_password
mongodb_escaped_username = quote_plus(mongodb_username)
mongodb_escaped_password = quote_plus(mongodb_password)

# Construct the MongoDB Atlas URI
mongo_uri = f"mongodb+srv://{mongodb_escaped_username}:{mongodb_escaped_password}@{mongodb_cluster_name}.mongodb.net/{mongodb_database_name}"
mongo_uri = payload_data["mongo_uri"]

# Call class instance
mongodb = MongoDBClass(
Expand Down
Loading

0 comments on commit 1105f57

Please sign in to comment.