FDSRashid commited on
Commit
ffaaf4c
·
1 Parent(s): 0ad6aae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -11,6 +11,8 @@ dataset2 = load_dataset('FDSRashid/hadith_info',data_files = 'masteredgecityrati
11
  edge_info = dataset.to_pandas()
12
  taraf_info = dataset2.to_pandas()
13
  cities = taraf_info['City'].unique().tolist()
 
 
14
 
15
  def subset_city_year( city , year ):
16
  edges = taraf_info[(taraf_info['Year'] == year) & (taraf_info['City'].isin(city))]
@@ -26,10 +28,10 @@ def get_narrators( city , year ):
26
  except Exception as e:
27
  return str(e)
28
 
29
- app = gr.Interface(get_narrators,
30
- [gr.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True),
31
- gr.Slider(-11,800, value = 50, label = 'Year', info = 'Choose The Year to Retrieve Narrators'),
32
- ],
33
- 'dataframe', live = True)
34
- app.launch()
35
 
 
11
  edge_info = dataset.to_pandas()
12
  taraf_info = dataset2.to_pandas()
13
  cities = taraf_info['City'].unique().tolist()
14
+ min_year = int(taraf_info['Year'].min())
15
+ max_year = int(taraf_info['Year'].max())
16
 
17
  def subset_city_year( city , year ):
18
  edges = taraf_info[(taraf_info['Year'] == year) & (taraf_info['City'].isin(city))]
 
28
  except Exception as e:
29
  return str(e)
30
 
31
+ with gr.Blocks() as demo:
32
+ Places = gr.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True, label = 'Location')
33
+ Last_Year = gr.Slider(min_year, max_year, value = 400, label = 'End', info = 'Choose the year to display Narrators')
34
+ btn = gr.Button('Submit')
35
+ btn.click(fn = get_narrators, inputs = [Places, Last_Year], outputs = gr.DataFrame())
36
+ demo.launch()
37