AliArshad commited on
Commit
ccc74ef
·
1 Parent(s): 549186a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -1,12 +1,16 @@
1
- import torch
2
- from transformers import XLNetTokenizer, XLNetForSequenceClassification
3
  import gradio as gr
4
 
5
- # Link to the saved model on Hugging Face Spaces
6
- model_link = 'https://huggingface.co/spaces/AliArshad/SeverityPrediction/blob/main/severitypredictor.pt'
7
 
8
- # Load the model directly from the link
9
- model = XLNetForSequenceClassification.from_pretrained(model_link)
 
 
 
 
10
 
11
  # Other model setup
12
  tokenizer = XLNetTokenizer.from_pretrained('xlnet-base-cased')
 
1
+ import os
2
+ from transformers import XLNetForSequenceClassification, XLNetTokenizer
3
  import gradio as gr
4
 
5
+ # Path where the repository will be cloned
6
+ repo_path = "./severity_prediction_model"
7
 
8
+ # Clone the repository containing the model
9
+ os.system(f"git lfs clone https://huggingface.co/spaces/AliArshad/SeverityPrediction {repo_path}")
10
+
11
+ # Load the model from the cloned repository
12
+ model_path = os.path.join(repo_path, "severitypredictor.pt")
13
+ model = XLNetForSequenceClassification.from_pretrained(model_path)
14
 
15
  # Other model setup
16
  tokenizer = XLNetTokenizer.from_pretrained('xlnet-base-cased')