EmmaScharfmannBerkeley commited on
Commit
f4f31d4
·
1 Parent(s): da42028

Change files path

Browse files
Climate_site/python_scripts/patent_functions.py CHANGED
@@ -16,6 +16,8 @@ from math import radians, cos, sin, asin, sqrt
16
 
17
  from sentence_transformers import SentenceTransformer, util
18
 
 
 
19
  @st.cache_resource
20
  def model_nlp():
21
  model = SentenceTransformer('all-MiniLM-L6-v2')
@@ -24,7 +26,7 @@ def model_nlp():
24
 
25
  @st.cache_data # 👈 Add the caching decorator
26
  def load_data():
27
- url = "Synapse_project/Climate_site/python_scripts/institutions.tsv"
28
  dic = pd.read_csv(url, delimiter = "\t" , index_col = 0).to_dict('index')
29
  return dic
30
 
@@ -110,7 +112,7 @@ def print_extracted_text(name_file):
110
 
111
  def details(name_file , display):
112
 
113
- file = open("Synapse_project/Climate_site/python_scripts/iea.txt", "r")
114
  lines = file.readlines()
115
 
116
  mark = 0
@@ -151,7 +153,7 @@ def details(name_file , display):
151
 
152
  def key_initiatives(name_file , display ):
153
 
154
- file = open('Synapse_project/Climate_site/python_scripts/iea.txt', "r", encoding='utf8')
155
  lines = file.readlines()
156
 
157
 
@@ -196,7 +198,7 @@ def key_initiatives(name_file , display ):
196
 
197
  def deployment_target(name_file , display):
198
 
199
- file = open('Synapse_project/Climate_site/python_scripts/iea.txt', "r", encoding='utf8')
200
  lines = file.readlines()
201
 
202
 
@@ -240,7 +242,7 @@ def deployment_target(name_file , display):
240
 
241
  def cost_reduction_target(name_file , display):
242
 
243
- file = open('Synapse_project/Climate_site/python_scripts/iea.txt', "r", encoding='utf8')
244
  lines = file.readlines()
245
 
246
  mark = 0
@@ -285,7 +287,7 @@ def cost_reduction_target(name_file , display):
285
 
286
  def key_words(name_file, display ):
287
 
288
- file = open('Synapse_project/Climate_site/python_scripts/iea.txt', "r", encoding='utf8')
289
 
290
  lines = file.readlines()
291
 
@@ -364,7 +366,7 @@ def key_words(name_file, display ):
364
 
365
  def technology(name_file, display ):
366
  # Filepath too specific, need to change to relative path
367
- file = open('Synapse_project/Climate_site/python_scripts/iea.txt', "r", encoding='utf8')
368
  lines = file.readlines()
369
 
370
  list_categories = []
@@ -849,44 +851,3 @@ def finder():
849
 
850
  return dic_technologies, dic_categories, list_categories_tech, list_technologies
851
 
852
- # technologies_widget = widgets.Dropdown(options=list_categories_tech,
853
- # description="Choose the category:" ,
854
- # style = {'description_width':'initial' } ,
855
- # layout=Layout(width='500px'));
856
-
857
- # category_widget = widgets.RadioButtons( values = 1,
858
- # description='Patents where the abstract contains:' ,
859
- # style = {'description_width':'initial' } ,
860
- # layout=Layout(width='1000px'));
861
-
862
- # number_technology_widget = widgets.Dropdown(options=list_technologies,
863
- # description="Choose the technology:" ,
864
- # style = {'description_width':'initial' } ,
865
- # layout=Layout(width='500px'));
866
-
867
- # def update_category(*args):
868
- # category_widget.options = dic_categories[number_technology_widget.value]
869
-
870
- # def update_technology(*args):
871
- # number_technology_widget.options = dic_technologies[technologies_widget.value]
872
-
873
-
874
- # number_technology_widget.observe(update_category)
875
- # technologies_widget.observe(update_technology)
876
-
877
- # print("Which patents are related to the technology?")
878
- # interact_manual(get_ranking_patents,
879
- # technologies=technologies_widget,
880
- # number_technology= number_technology_widget ,
881
- # carbon_related=widgets.Dropdown(options=list_climate,
882
- # description="Select the type of patents:" ,
883
- # style = {'description_width':'initial' } ,
884
- # layout=Layout(width='500px') ) ,
885
- # size = widgets.IntSlider(min=3,
886
- # max=100,
887
- # value=10,
888
- # step=1,
889
- # description="Select the number of patents:" ,
890
- # style = {'description_width':'initial' } ,
891
- # layout=Layout(width='500px')),
892
- # category = category_widget);
 
16
 
17
  from sentence_transformers import SentenceTransformer, util
18
 
19
+ path = "Climate_site/python_scripts/"
20
+
21
  @st.cache_resource
22
  def model_nlp():
23
  model = SentenceTransformer('all-MiniLM-L6-v2')
 
26
 
27
  @st.cache_data # 👈 Add the caching decorator
28
  def load_data():
29
+ url = path + "institutions.tsv"
30
  dic = pd.read_csv(url, delimiter = "\t" , index_col = 0).to_dict('index')
31
  return dic
32
 
 
112
 
113
  def details(name_file , display):
114
 
115
+ file = open(path + "iea.txt", "r")
116
  lines = file.readlines()
117
 
118
  mark = 0
 
153
 
154
  def key_initiatives(name_file , display ):
155
 
156
+ file = open(path + 'iea.txt', "r", encoding='utf8')
157
  lines = file.readlines()
158
 
159
 
 
198
 
199
  def deployment_target(name_file , display):
200
 
201
+ file = open(path + 'iea.txt', "r", encoding='utf8')
202
  lines = file.readlines()
203
 
204
 
 
242
 
243
  def cost_reduction_target(name_file , display):
244
 
245
+ file = open(path + 'iea.txt', "r", encoding='utf8')
246
  lines = file.readlines()
247
 
248
  mark = 0
 
287
 
288
  def key_words(name_file, display ):
289
 
290
+ file = open(path + 'iea.txt', "r", encoding='utf8')
291
 
292
  lines = file.readlines()
293
 
 
366
 
367
  def technology(name_file, display ):
368
  # Filepath too specific, need to change to relative path
369
+ file = open(path + 'iea.txt', "r", encoding='utf8')
370
  lines = file.readlines()
371
 
372
  list_categories = []
 
851
 
852
  return dic_technologies, dic_categories, list_categories_tech, list_technologies
853