FDSRashid commited on
Commit
bae2abf
·
1 Parent(s): dcda834

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -9,20 +9,20 @@ Secret_token = os.getenv('token')
9
  dataset = load_dataset('FDSRashid/hadith_info',data_files = 'Basic_Edge_Information.csv', token = Secret_token, split = 'train')
10
  edge_info = dataset.to_pandas()
11
 
12
- def subset_city_year(year = 50, city = ['المدينه', 'بغداد', 'كوفة', 'بصرة']):
13
  edges = edge_info[(edge_info['Year'] == year) & (edge_info['City'].isin(city))]
14
  return edges
15
 
16
 
17
 
18
- def get_narrators(year = 50, city = ['المدينه', 'بغداد', 'كوفة', 'بصرة']):
19
  df = subset_city_year(year, city)
20
  narrators = edge_info[edge_info['Edge_ID'].isin(df['ID'])]
21
  return narrators['Edge_Name'].reset_index().drop('index', axis = 1).rename(columns = {'Edge_Name': 'Teacher To Student'})
22
 
23
- app = gradio.Interface(get_narrators,
24
- [gradio.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True),
25
- gradio.Slider(min_year, max_year, value = 0, label = 'Begining', info = 'Choose The Year to Retrieve Narrators'),
26
  ],
27
  gr.Dataframe()).launch()
28
 
 
9
  dataset = load_dataset('FDSRashid/hadith_info',data_files = 'Basic_Edge_Information.csv', token = Secret_token, split = 'train')
10
  edge_info = dataset.to_pandas()
11
 
12
+ def subset_city_year( city = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], year = 50):
13
  edges = edge_info[(edge_info['Year'] == year) & (edge_info['City'].isin(city))]
14
  return edges
15
 
16
 
17
 
18
+ def get_narrators( city = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], year = 50):
19
  df = subset_city_year(year, city)
20
  narrators = edge_info[edge_info['Edge_ID'].isin(df['ID'])]
21
  return narrators['Edge_Name'].reset_index().drop('index', axis = 1).rename(columns = {'Edge_Name': 'Teacher To Student'})
22
 
23
+ app = gr.Interface(get_narrators,
24
+ [gr.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True),
25
+ gr.Slider(min_year, max_year, value = 50, label = 'Begining', info = 'Choose The Year to Retrieve Narrators'),
26
  ],
27
  gr.Dataframe()).launch()
28