aliasgerovs commited on
Commit
72fe634
1 Parent(s): 7aa72dc

Added deployment updates.

Browse files
Files changed (3) hide show
  1. app.py +4 -4
  2. update_and_restart.sh +17 -0
  3. webhooks.json +7 -0
app.py CHANGED
@@ -173,14 +173,15 @@ def plagiarism_check(
173
  """
174
  AI DETECTION SECTION
175
  """
 
176
 
177
  text_bc_model_path = "polygraf-ai/ai-text-bc-bert-2-7m"
178
  text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path)
179
- text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path)
180
 
181
  text_mc_model_path = "polygraf-ai/ai-text-mc-v5-lighter-spec"
182
  text_mc_tokenizer = AutoTokenizer.from_pretrained(text_mc_model_path)
183
- text_mc_model = AutoModelForSequenceClassification.from_pretrained(text_mc_model_path)
184
 
185
  def remove_special_characters(text):
186
  cleaned_text = re.sub(r'[^a-zA-Z0-9\s]', '', text)
@@ -297,7 +298,6 @@ subprocess.run(command)
297
  nlp = spacy.load("en_core_web_sm")
298
 
299
  # for perplexity
300
- device = "cuda" if torch.cuda.is_available() else "cpu"
301
  model_id = "gpt2"
302
  gpt2_model = GPT2LMHeadModel.from_pretrained(model_id).to(device)
303
  gpt2_tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
@@ -557,4 +557,4 @@ with gr.Blocks() as demo:
557
 
558
  date_from = ""
559
  date_to = ""
560
- demo.launch(share=True, server_name="0.0.0.0", server_port=80)
 
173
  """
174
  AI DETECTION SECTION
175
  """
176
+ device = "cuda" if torch.cuda.is_available() else "cpu"
177
 
178
  text_bc_model_path = "polygraf-ai/ai-text-bc-bert-2-7m"
179
  text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path)
180
+ text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path).to(device)
181
 
182
  text_mc_model_path = "polygraf-ai/ai-text-mc-v5-lighter-spec"
183
  text_mc_tokenizer = AutoTokenizer.from_pretrained(text_mc_model_path)
184
+ text_mc_model = AutoModelForSequenceClassification.from_pretrained(text_mc_model_path).to(device)
185
 
186
  def remove_special_characters(text):
187
  cleaned_text = re.sub(r'[^a-zA-Z0-9\s]', '', text)
 
298
  nlp = spacy.load("en_core_web_sm")
299
 
300
  # for perplexity
 
301
  model_id = "gpt2"
302
  gpt2_model = GPT2LMHeadModel.from_pretrained(model_id).to(device)
303
  gpt2_tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
 
557
 
558
  date_from = ""
559
  date_to = ""
560
+ demo.launch(share=True, server_name="0.0.0.0", server_port=7860)
update_and_restart.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #!/bin/bash
3
+
4
+ # Navigate to your app's directory
5
+ cd /home/aliasgarov/copyright_checker
6
+
7
+ # Pull the latest changes from the main branch
8
+ git pull origin main
9
+
10
+ # Kill the running Gradio
11
+ pkill -f "app.py"
12
+
13
+ # Activate your Python environment if necessary
14
+ # source /path/to/your/venv/bin/activate
15
+
16
+ # Start your Gradio app (adjust the command as needed)
17
+ nohup python app.py &
webhooks.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "id": "update-gradio-app",
4
+ "execute-command": "/home/aliasgarov/copyright_checker/update_and_restart.sh",
5
+ "command-working-directory": "/home/aliasgarov/copyright_checker/app.py"
6
+ }
7
+ ]