Update app.py
Browse files
app.py
CHANGED
@@ -29,13 +29,18 @@ narrator_bios.loc[49845, 'Number of Narrations'] = 327512
|
|
29 |
narrator_bios['Generation'] = narrator_bios['Generation'].replace([None], [-1])
|
30 |
narrator_bios['Generation'] = narrator_bios['Generation'].astype(int)
|
31 |
|
32 |
-
|
|
|
|
|
33 |
|
34 |
edge_info = dataset.to_pandas()
|
35 |
taraf_info = dataset2.to_pandas()
|
36 |
min_year = int(taraf_info['Year'].min())
|
37 |
max_year = int(taraf_info['Year'].max())
|
38 |
cmap = plt.colormaps['cool']
|
|
|
|
|
|
|
39 |
def value_to_hex(value):
|
40 |
rgba_color = cmap(value)
|
41 |
return "#{:02X}{:02X}{:02X}".format(int(rgba_color[0] * 255), int(rgba_color[1] * 255), int(rgba_color[2] * 255))
|
@@ -94,6 +99,12 @@ with gr.Blocks() as demo:
|
|
94 |
text_output = gr.DataFrame()
|
95 |
text_button = gr.Button("Search")
|
96 |
text_button.click(narrator_retriever, inputs=text_input, outputs=text_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
with gr.Tab("Visualize Network"):
|
98 |
with gr.Row():
|
99 |
image_input = gr.Number()
|
|
|
29 |
narrator_bios['Generation'] = narrator_bios['Generation'].replace([None], [-1])
|
30 |
narrator_bios['Generation'] = narrator_bios['Generation'].astype(int)
|
31 |
|
32 |
+
cols = narrator_bios.columns.tolist()
|
33 |
+
def filter_df(df, col, val):
|
34 |
+
return df[df[col] == val]
|
35 |
|
36 |
edge_info = dataset.to_pandas()
|
37 |
taraf_info = dataset2.to_pandas()
|
38 |
min_year = int(taraf_info['Year'].min())
|
39 |
max_year = int(taraf_info['Year'].max())
|
40 |
cmap = plt.colormaps['cool']
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
def value_to_hex(value):
|
45 |
rgba_color = cmap(value)
|
46 |
return "#{:02X}{:02X}{:02X}".format(int(rgba_color[0] * 255), int(rgba_color[1] * 255), int(rgba_color[2] * 255))
|
|
|
99 |
text_output = gr.DataFrame()
|
100 |
text_button = gr.Button("Search")
|
101 |
text_button.click(narrator_retriever, inputs=text_input, outputs=text_output)
|
102 |
+
|
103 |
+
col = gr.Dropdown(choices = cols)
|
104 |
+
df_filter = gr.Textbox()
|
105 |
+
filter_button = gr.Button('Filter')
|
106 |
+
output2 = gr.DataFrame(filter_df, inputs = [text_output, col, df_filter], outputs= [gr.DataFrame()])
|
107 |
+
filter_button.click()
|
108 |
with gr.Tab("Visualize Network"):
|
109 |
with gr.Row():
|
110 |
image_input = gr.Number()
|