Spaces:
Sleeping
Sleeping
VenkateshRoshan commited on
Commit ·
3405f58
1
Parent(s): 0354ffb
Automated Deployment script added
Browse files- app.py +2 -0
- my_key +7 -0
- my_key.pub +1 -0
- setup.sh +71 -0
- student-admin_key +7 -0
app.py
CHANGED
|
@@ -16,6 +16,8 @@ model_id = "openai/whisper-small"
|
|
| 16 |
client = InferenceClient(model_id)
|
| 17 |
pipe = pipeline("automatic-speech-recognition", model=model_id) #, device=device)
|
| 18 |
|
|
|
|
|
|
|
| 19 |
def transcribe(inputs, use_api):
|
| 20 |
start = time.time()
|
| 21 |
API_STATUS = ''
|
|
|
|
| 16 |
client = InferenceClient(model_id)
|
| 17 |
pipe = pipeline("automatic-speech-recognition", model=model_id) #, device=device)
|
| 18 |
|
| 19 |
+
print(f'The Server is Running !!!')
|
| 20 |
+
|
| 21 |
def transcribe(inputs, use_api):
|
| 22 |
start = time.time()
|
| 23 |
API_STATUS = ''
|
my_key
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN OPENSSH PRIVATE KEY-----
|
| 2 |
+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
| 3 |
+
QyNTUxOQAAACDdxzCugxOrMl8rh/n/du1nZHcj9vseRA7okxOZW7ph2gAAAJAlaoGRJWqB
|
| 4 |
+
kQAAAAtzc2gtZWQyNTUxOQAAACDdxzCugxOrMl8rh/n/du1nZHcj9vseRA7okxOZW7ph2g
|
| 5 |
+
AAAEDw9BI1H8LS1o/tfTLaDc1/HhO/owO6EeyL1B0QK9hnct3HMK6DE6syXyuH+f927Wdk
|
| 6 |
+
dyP2+x5EDuiTE5lbumHaAAAAC2FidmVuQGFidmVuAQI=
|
| 7 |
+
-----END OPENSSH PRIVATE KEY-----
|
my_key.pub
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN3HMK6DE6syXyuH+f927WdkdyP2+x5EDuiTE5lbumHa abven@abven
|
setup.sh
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash
|
| 2 |
+
|
| 3 |
+
# Server details
|
| 4 |
+
PORT=22013
|
| 5 |
+
HOST=paffenroth-23.dyn.wpi.edu
|
| 6 |
+
USER=student-admin
|
| 7 |
+
|
| 8 |
+
ssh_key_path=./
|
| 9 |
+
old_ssh_key_name=./student-admin_key
|
| 10 |
+
|
| 11 |
+
# remove keys if already present
|
| 12 |
+
rm -f $ssh_key_path/my_key*
|
| 13 |
+
|
| 14 |
+
# TODO : Add password to the ssh key and store it in a file and read the file and get the password
|
| 15 |
+
|
| 16 |
+
# Generate SSH key
|
| 17 |
+
ssh-keygen -f my_key -t ed25519 -N ""
|
| 18 |
+
|
| 19 |
+
# Copy the private key into a variable
|
| 20 |
+
# new_ssh_key=$(<my_key)
|
| 21 |
+
|
| 22 |
+
# # Print the private key
|
| 23 |
+
# echo "Private Key:"
|
| 24 |
+
# echo "$new_ssh_key"
|
| 25 |
+
|
| 26 |
+
# Copy the public key into a new_ssh_key variable
|
| 27 |
+
new_ssh_pub_key=$(<my_key.pub)
|
| 28 |
+
|
| 29 |
+
# Print the public key
|
| 30 |
+
echo "Public Key:"
|
| 31 |
+
echo "$new_ssh_pub_key"
|
| 32 |
+
|
| 33 |
+
# Use the old SSH key to connect to the server and append the new public key to authorized_keys
|
| 34 |
+
ssh -i "$old_ssh_key_name" -p "$PORT" "$USER@$HOST" "echo '$new_ssh_pub_key' >> /home/student-admin/.ssh/authorized_keys && chmod 600 /home/student-admin/.ssh/authorized_keys"
|
| 35 |
+
|
| 36 |
+
# TODO : Comment the old ssh key in the authorized_keys file
|
| 37 |
+
#
|
| 38 |
+
|
| 39 |
+
# Verify if the key has been added successfully
|
| 40 |
+
echo "New public key added to authorized_keys on the server."
|
| 41 |
+
|
| 42 |
+
# Make a variable to store the SSH connection command with
|
| 43 |
+
SSH_CONNECTION="ssh -i my_key -p $PORT $USER@$HOST"
|
| 44 |
+
|
| 45 |
+
# run a command to create apt install python3-venv
|
| 46 |
+
# ssh -i "$old_ssh_key_name" -p "$PORT" "$USER@$HOST" "sudo apt-get update && sudo apt-get install python3-venv"
|
| 47 |
+
$SSH_CONNECTION "sudo apt-get update && sudo apt-get install python3-venv"
|
| 48 |
+
|
| 49 |
+
VENV=./env
|
| 50 |
+
|
| 51 |
+
# creating a virtual environment
|
| 52 |
+
# ssh -i "$old_ssh_key_name" -p "$PORT" "$USER@$HOST" "python3 -m venv $VENV"
|
| 53 |
+
$SSH_CONNECTION "python3 -m venv $VENV"
|
| 54 |
+
|
| 55 |
+
echo "Virtual environment created. in $VENV"
|
| 56 |
+
|
| 57 |
+
# path of git repo
|
| 58 |
+
GIT_REPO_PATH=https://github.com/VenkateshRoshan/MLOPs-CaseStudy1.git
|
| 59 |
+
|
| 60 |
+
# Clone the git repo
|
| 61 |
+
# ssh -i "$old_ssh_key_name" -p "$PORT" "$USER@$HOST" "git clone $GIT_REPO_PATH"
|
| 62 |
+
$SSH_CONNECTION "git clone $GIT_REPO_PATH"
|
| 63 |
+
|
| 64 |
+
# Activate the virtual environment
|
| 65 |
+
# ssh -i "$old_ssh_key_name" -p "$PORT" "$USER@$HOST" "source $VENV/bin/activate && sudo apt install ffmpeg && cd MLOPs-CaseStudy1 && pip install -r requirements.txt"
|
| 66 |
+
$SSH_CONNECTION "source $VENV/bin/activate && sudo apt install ffmpeg && cd MLOPs-CaseStudy1 && pip install -r requirements.txt"
|
| 67 |
+
|
| 68 |
+
# Activate the virtual environment and run the server
|
| 69 |
+
$SSH_CONNECTION "source $VENV/bin/activate && cd MLOPs-CaseStudy1 && python3 app.py"
|
| 70 |
+
|
| 71 |
+
# The URL Path : rcpaffenroth-23.dyn.wpi.edu:8013 (Gradio Port (8000) + Group Number(13) )
|
student-admin_key
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN OPENSSH PRIVATE KEY-----
|
| 2 |
+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
| 3 |
+
QyNTUxOQAAACAACRjdkS5FFxssF234a3fpZuOrXaEn1A4rLSxUNy+vbQAAAKAnwtEgJ8LR
|
| 4 |
+
IAAAAAtzc2gtZWQyNTUxOQAAACAACRjdkS5FFxssF234a3fpZuOrXaEn1A4rLSxUNy+vbQ
|
| 5 |
+
AAAEBUA21ze68DxYwSY9Fn+Tv8nDJ+sG4CzyfXy/QbRuqZmQAJGN2RLkUXGywXbfhrd+lm
|
| 6 |
+
46tdoSfUDistLFQ3L69tAAAAGnJjcGFmZmVucm90aEBwYWZmZW5yb3RoLTIzAQID
|
| 7 |
+
-----END OPENSSH PRIVATE KEY-----
|