RohitManglik commited on
Commit
01ecf84
·
verified ·
1 Parent(s): 3fbee35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  import gradio as gr
2
  import torch
3
  import torch.nn.functional as F
@@ -8,6 +13,24 @@ import pickle
8
  # 📁 Load model
9
  model_path = "InfoBayAI/Audio-to-Sentiment_Intelligence_Model"
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  tokenizer = DistilBertTokenizer.from_pretrained(model_path)
12
  model = DistilBertForSequenceClassification.from_pretrained(model_path)
13
 
 
1
+ import os
2
+ from huggingface_hub import login
3
+
4
+ login(token=os.getenv("HF_TOKEN"))
5
+
6
  import gradio as gr
7
  import torch
8
  import torch.nn.functional as F
 
13
  # 📁 Load model
14
  model_path = "InfoBayAI/Audio-to-Sentiment_Intelligence_Model"
15
 
16
+ tokenizer = DistilBertTokenizer.from_pretrained(
17
+ model_path,
18
+ token=os.getenv("HF_TOKEN")
19
+ )
20
+
21
+ model = DistilBertForSequenceClassification.from_pretrained(
22
+ model_path,
23
+ token=os.getenv("HF_TOKEN")
24
+ )
25
+
26
+ from huggingface_hub import hf_hub_download
27
+
28
+ label_path = hf_hub_download(
29
+ repo_id=model_path,
30
+ filename="label_encoder.pkl",
31
+ token=os.getenv("HF_TOKEN")
32
+ )
33
+
34
  tokenizer = DistilBertTokenizer.from_pretrained(model_path)
35
  model = DistilBertForSequenceClassification.from_pretrained(model_path)
36