henry2024 commited on
Commit
d1dece6
1 Parent(s): c215499

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -48,30 +48,30 @@ class GRU_model(nn.Module):
48
  def __init__(self):
49
  super().__init__()
50
 
51
- self.rnn= nn.GRU(input_size=1477, hidden_size=240,num_layers=1, bias= True).to('cuda') ## nonlinearity= 'relu',
52
- self.output= nn.Linear(in_features=240, out_features=24).to('cuda')
53
 
54
  def forward(self, x):
55
  y, hidden= self.rnn(x)
56
- y = y.to('cuda')
57
- x= self.output(y).to('cuda')
58
  return(x)
59
 
60
  class RNN_model(nn.Module):
61
  def __init__(self):
62
  super().__init__()
63
 
64
- self.rnn= nn.RNN(input_size=1477, hidden_size=240,num_layers=1, nonlinearity= 'relu', bias= True).to('cuda')
65
- self.output= nn.Linear(in_features=240, out_features=24).to('cuda')
66
 
67
  def forward(self, x):
68
  y, hidden= self.rnn(x)
69
- y = y.to('cuda')
70
- x= self.output(y).to('cuda')
71
  return(x)
72
 
73
- #embedder = SentenceTransformer("bge-small-en-v1.5", device="cuda")
74
- #embedder = SentenceTransformer("bge-small-en-v1.5", device="cuda")
75
 
76
  df= pd.read_csv('Symptom2Disease_1.csv')
77
 
@@ -216,7 +216,7 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
216
  bot_message= random.choice(goodbyes_replies)
217
  else:
218
  transformed_new= vectorizer.transform([message])
219
- transformed_new= torch.tensor(transformed_new.toarray()).to(torch.float32).to('cuda')
220
  #transform_text= vectorizer.transform([message])
221
  #sentence_embeddings = embedder.encode(message)
222
  #sentence_embeddings = torch.from_numpy(sentence_embeddings).float().to(device).unsqueeze(dim=0)
 
48
  def __init__(self):
49
  super().__init__()
50
 
51
+ self.rnn= nn.GRU(input_size=1477, hidden_size=240,num_layers=1, bias= True).to(device) ## nonlinearity= 'relu',
52
+ self.output= nn.Linear(in_features=240, out_features=24).to(device)
53
 
54
  def forward(self, x):
55
  y, hidden= self.rnn(x)
56
+ y = y.to(device)
57
+ x= self.output(y).to(device)
58
  return(x)
59
 
60
  class RNN_model(nn.Module):
61
  def __init__(self):
62
  super().__init__()
63
 
64
+ self.rnn= nn.RNN(input_size=1477, hidden_size=240,num_layers=1, nonlinearity= 'relu', bias= True).to(device)
65
+ self.output= nn.Linear(in_features=240, out_features=24).to(device)
66
 
67
  def forward(self, x):
68
  y, hidden= self.rnn(x)
69
+ y = y.to(device)
70
+ x= self.output(y).to(device)
71
  return(x)
72
 
73
+ #embedder = SentenceTransformer("bge-small-en-v1.5", device=device)
74
+ #embedder = SentenceTransformer("bge-small-en-v1.5", device=device)
75
 
76
  df= pd.read_csv('Symptom2Disease_1.csv')
77
 
 
216
  bot_message= random.choice(goodbyes_replies)
217
  else:
218
  transformed_new= vectorizer.transform([message])
219
+ transformed_new= torch.tensor(transformed_new.toarray()).to(torch.float32).to(device)
220
  #transform_text= vectorizer.transform([message])
221
  #sentence_embeddings = embedder.encode(message)
222
  #sentence_embeddings = torch.from_numpy(sentence_embeddings).float().to(device).unsqueeze(dim=0)