FDSRashid commited on
Commit
051ae15
·
1 Parent(s): b085b6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -2,7 +2,7 @@
2
 
3
 
4
  import numpy as np
5
- import gradio
6
  import os
7
  import pandas as pd
8
  from datasets import load_dataset
@@ -30,10 +30,22 @@ def plot_timeline(yaxis, citi = ['المدينه', 'بغداد', 'كوفة', 'ب
30
  fig.update_layout(title_font_color = 'red', title_x = .5)
31
  return fig
32
 
33
- app = gradio.Interface(plot_timeline,
34
- [gradio.Dropdown(choices = ['Taraf', 'Hadith', 'Isnad', 'Ranking'], value = 'Taraf', label = 'Y Axis'), gradio.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True),
35
- gradio.Slider(min_year, max_year, value = 0, label = 'Begining', info = 'Choose the first year to display Tarafs'),
36
- gradio.Slider(min_year, max_year, value = 400, label = 'End', info = 'Choose the last year to display Tarafs')
37
-
38
- ],
39
- gradio.Plot()).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
 
4
  import numpy as np
5
+ import gradio as gr
6
  import os
7
  import pandas as pd
8
  from datasets import load_dataset
 
30
  fig.update_layout(title_font_color = 'red', title_x = .5)
31
  return fig
32
 
33
+ # app = gradio.Interface(plot_timeline,
34
+ # [gradio.Dropdown(choices = ['Taraf', 'Hadith', 'Isnad', 'Ranking'], value = 'Taraf', label = 'Y Axis'), gradio.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True),
35
+ # gradio.Slider(min_year, max_year, value = 0, label = 'Begining', info = 'Choose the first year to display Tarafs'),
36
+ # gradio.Slider(min_year, max_year, value = 400, label = 'End', info = 'Choose the last year to display Tarafs')
37
+
38
+ # ],
39
+ # gradio.Plot()).launch()
40
+
41
+
42
+ demo = gr.Blocks()
43
+ with demo:
44
+ with gr.Row():
45
+ y_value = gradio.Dropdown(choices = ['Taraf', 'Hadith', 'Isnad', 'Ranking'], value = 'Taraf', label = 'Y Axis')
46
+ city = gradio.Dropdown(choices = cities, value = ['المدينه', 'بغداد', 'كوفة', 'بصرة'], multiselect=True)
47
+ begining = gradio.Slider(min_year, max_year, value = 0, label = 'Begining', info = 'Choose the first year to display Tarafs')
48
+ end = gradio.Slider(min_year, max_year, value = 400, label = 'End', info = 'Choose the last year to display Tarafs')
49
+ btn = gr.Button("Plot")
50
+ btn.click(plot_timeline, [y_value,city, begining, end], gr.Plot())
51
+ demo.launch()