Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,14 +6,23 @@ from datasets import load_dataset
|
|
6 |
|
7 |
Secret_token = os.getenv('token')
|
8 |
|
9 |
-
dataset = load_dataset('FDSRashid/hadith_info',data_files = '
|
10 |
-
|
11 |
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
-
def greet(name):
|
15 |
-
return "Hello " + name + "!"
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
demo.launch()
|
|
|
6 |
|
7 |
Secret_token = os.getenv('token')
|
8 |
|
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 |
|
|