rgp230 commited on
Commit
a640fc0
·
1 Parent(s): 5d6eff6

fix(remove_tf): Unblock container build by removing tf dependency

Browse files
requirements.txt CHANGED
@@ -11,6 +11,4 @@ streamlit
11
  transformers[torch]
12
  langchain_openai
13
  langchain_google_genai
14
- tf-keras
15
- tensorflow
16
  torch
 
11
  transformers[torch]
12
  langchain_openai
13
  langchain_google_genai
 
 
14
  torch
src/graph/__pycache__/state_vector_nodes.cpython-312.pyc CHANGED
Binary files a/src/graph/__pycache__/state_vector_nodes.cpython-312.pyc and b/src/graph/__pycache__/state_vector_nodes.cpython-312.pyc differ
 
src/graph/state_vector_nodes.py CHANGED
@@ -7,13 +7,14 @@ from state.state import StateVector
7
  from streamlitui.constants import *
8
  import torch
9
  import torch.nn.functional as F
10
- import tensorflow as tf
11
  import re
12
  from langchain_openai import ChatOpenAI
13
  from langchain_community.tools.semanticscholar.tool import SemanticScholarQueryRun
14
  from langchain_community.utilities.semanticscholar import SemanticScholarAPIWrapper
15
  from langchain_community.tools.tavily_search import TavilySearchResults
16
  import pandas as pd
 
17
 
18
 
19
  class question_model:
@@ -48,12 +49,16 @@ class question_model:
48
  text=state.get('seed_question').lower(),
49
  truncation=True,
50
  padding=True,
51
- return_tensors="tf")
52
- output = self.distilbert_model(predict_input)[0]
53
- #prediction_value = torch.argmax(output, dim=1).cpu().numpy()
 
 
 
 
54
  #prob_value = F.softmax(output, dim=1).cpu().numpy()[0]
55
- prediction_value = tf.argmax(output, axis=1).numpy()#All answers
56
- prob_value=tf.nn.softmax(output).numpy()[0]#Probability of TF output
57
  Topic_Bool=prob_value>0.4
58
  Topics=[]
59
  Keywords={}
 
7
  from streamlitui.constants import *
8
  import torch
9
  import torch.nn.functional as F
10
+ #import tensorflow as tf
11
  import re
12
  from langchain_openai import ChatOpenAI
13
  from langchain_community.tools.semanticscholar.tool import SemanticScholarQueryRun
14
  from langchain_community.utilities.semanticscholar import SemanticScholarAPIWrapper
15
  from langchain_community.tools.tavily_search import TavilySearchResults
16
  import pandas as pd
17
+ import torch.nn.functional as F
18
 
19
 
20
  class question_model:
 
49
  text=state.get('seed_question').lower(),
50
  truncation=True,
51
  padding=True,
52
+ return_tensors="pt")
53
+ output = self.distilbert_model(predict_input.numpy())[0]
54
+ numpy_output=output.numpy()
55
+ torch_output=torch.from_numpy(numpy_output)
56
+ prediction_value = torch.argmax(torch_output, dim=1).numpy() # All answers
57
+ prob_value=F.softmax(torch_output).numpy()[0]
58
+
59
  #prob_value = F.softmax(output, dim=1).cpu().numpy()[0]
60
+ #prediction_value = tf.argmax(output, axis=1).numpy()#All answers
61
+ #prob_value=tf.nn.softmax(output).numpy()[0]#Probability of TF output
62
  Topic_Bool=prob_value>0.4
63
  Topics=[]
64
  Keywords={}