Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -42,26 +42,29 @@ def get_chunks():
|
|
42 |
projects_df = pd.merge(projects_df, sector_df, on='iati_id', how='inner')
|
43 |
projects_df = pd.merge(projects_df, status_df, on='iati_id', how='inner')
|
44 |
projects_df = pd.merge(projects_df, texts_df, on='iati_id', how='inner')
|
45 |
-
|
46 |
|
47 |
-
|
48 |
'orga_full_name', 'country',
|
49 |
'country_flag', 'crs_5_code', 'crs_3_code',
|
50 |
'sgd_pred_code'], inplace=True)
|
|
|
|
|
|
|
|
|
51 |
|
52 |
#### code for eading the giz_worldwide data
|
53 |
-
|
54 |
-
|
55 |
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
|
61 |
|
62 |
-
|
63 |
-
giz_df['chunks'] = giz_df.apply(lambda x:create_chunks(x['title_main'] + x['description_main']),axis=1)
|
64 |
-
giz_df = giz_df.explode(column=['chunks'], ignore_index=True)
|
65 |
|
66 |
placeholder= []
|
67 |
for i in range(len(giz_df)):
|
|
|
42 |
projects_df = pd.merge(projects_df, sector_df, on='iati_id', how='inner')
|
43 |
projects_df = pd.merge(projects_df, status_df, on='iati_id', how='inner')
|
44 |
projects_df = pd.merge(projects_df, texts_df, on='iati_id', how='inner')
|
45 |
+
projects_df = projects_df[projects_df.client.str.contains('bmz')].reset_index(drop=True)
|
46 |
|
47 |
+
projects_df.drop(columns= ['orga_abbreviation', 'client',
|
48 |
'orga_full_name', 'country',
|
49 |
'country_flag', 'crs_5_code', 'crs_3_code',
|
50 |
'sgd_pred_code'], inplace=True)
|
51 |
+
print(projects_df.columns)
|
52 |
+
projects_df['text_size'] = projects_df.apply(lambda x: len((x['title_main'] + x['description_main']).split()), axis=1)
|
53 |
+
projects_df['chunks'] = projects_df.apply(lambda x:create_chunks(x['title_main'] + x['description_main']),axis=1)
|
54 |
+
projects_df = projects_df.explode(column=['chunks'], ignore_index=True)
|
55 |
|
56 |
#### code for eading the giz_worldwide data
|
57 |
+
giz_df = pd.read_json('iati_files/data_giz_website.json')
|
58 |
+
giz_df = giz_df.rename(columns={'content':'project_description'})
|
59 |
|
60 |
|
61 |
+
giz_df['text_size'] = giz_df.apply(lambda x: len((x['project_name'] + x['project_description']).split()), axis=1)
|
62 |
+
giz_df['chunks'] = giz_df.apply(lambda x:create_chunks(x['project_name'] + x['project_description']),axis=1)
|
63 |
+
giz_df = giz_df.explode(column=['chunks'], ignore_index=True)
|
64 |
+
print(giz_df.columns)
|
65 |
|
66 |
|
67 |
+
|
|
|
|
|
68 |
|
69 |
placeholder= []
|
70 |
for i in range(len(giz_df)):
|