MaksG commited on
Commit
3b26dac
1 Parent(s): 8a26c7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -14,9 +14,11 @@ with gr.Blocks() as demo:
14
  gr.Markdown("## Extaction, Classification and AI tool")
15
  with gr.Tab("File extraction"):
16
  gr.Markdown(" Put either just a link, or a link and an excel file with an 'Actions' column")
17
- tb_url = gr.Textbox(label="URL (e.g. https://www.3gpp.org/ftp/TSG_SA/WG1_Serv/TSGS1_105_Athens/Docs)")
 
 
18
  btn_extract = gr.Button("Extract excel from URL")
19
- tb_status_message = gr.Textbox(label="Status")
20
 
21
  with gr.Tab("Query on columns with mistral"):
22
  dd_source_ask = gr.Dropdown(label="Source Column(s)", multiselect=True)
@@ -27,6 +29,8 @@ with gr.Blocks() as demo:
27
 
28
  with gr.Tab("Classification by topic"):
29
  dd_source_class = gr.Dropdown(label="Source Column", multiselect=False)
 
 
30
  btn_classif = gr.Button("Categorize")
31
 
32
  with gr.Tab("Charts Generation"):
@@ -37,31 +41,30 @@ with gr.Blocks() as demo:
37
  plt_figure = gr.Plot()
38
 
39
  with gr.Tab("Chart Generation"):
 
40
  with gr.Tab("Overall"):
41
- btn_overall = gr.Button("Overall Review")
42
  with gr.Tab("By Expert"):
43
  rd_exp=gr.Radio(["Satellite Networks / Nicolas", "Emergency Communication / Dorin", "Trend Analysis / Ly-Thanh", "Security Trust / Mireille", "Distributed Networks / Guillaume", "Network Security / Khawla", "USIM Management / Vincent", "Eco-Design / Pierre"], label="Expert Name")
44
  btn_expert = gr.Button("Top 10 by expert")
45
  with gr.Tab("By Company"):
46
  tb_com=gr.Textbox(label="Company Name",info="You can write 1, 2 or 3 company names at the same time")
47
- btn_type = gr.Button("Document type by company")
48
  with gr.Row():
49
  plt_chart = gr.Plot(label="Graphique")
50
  plt_chart2 = gr.Plot(label="Graphique")
51
  plt_chart3 = gr.Plot(label="Graphique")
52
-
53
  with gr.Accordion("Excel Preview", open=False):
54
- df_output = gr.DataFrame()
55
-
56
  fi_excel = gr.File(label="Excel File")
57
 
58
  fi_excel.change(get_columns, inputs=[fi_excel], outputs=[dd_source_ask, dd_source_class, dd_label1, dd_label2, df_output])
59
 
60
- btn_extract.click(extractionPrincipale, inputs=[tb_url, fi_excel], outputs=[fi_excel, tb_status_message])
61
 
62
- mist_button.click(chat_with_mistral, inputs=[dd_source_ask, tb_destcol, tb_prompt, tb_filename, fi_excel, tb_url], outputs=[fi_excel, df_output])
63
 
64
- btn_classif.click(classification, inputs=[dd_source_class, fi_excel], outputs=[fi_excel, df_output])
65
 
66
  btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
67
 
 
14
  gr.Markdown("## Extaction, Classification and AI tool")
15
  with gr.Tab("File extraction"):
16
  gr.Markdown(" Put either just a link, or a link and an excel file with an 'Actions' column")
17
+ with gr.Row():
18
+ dd_url = gr.Dropdown(label="(e.g. https://www.3gpp.org/ftp/TSG_SA/WG1_Serv/TSGS1_105_Athens/Docs)", multiselect=False, value="https://www.3gpp.org/ftp/", allow_custom_value=True, scale=9)
19
+ btn_search = gr.Button("Search")
20
  btn_extract = gr.Button("Extract excel from URL")
21
+ tb_message = gr.Textbox(label="Status")
22
 
23
  with gr.Tab("Query on columns with mistral"):
24
  dd_source_ask = gr.Dropdown(label="Source Column(s)", multiselect=True)
 
29
 
30
  with gr.Tab("Classification by topic"):
31
  dd_source_class = gr.Dropdown(label="Source Column", multiselect=False)
32
+ gr.Markdown("### The predefined categories can be modified at any time")
33
+ df_category = gr.DataFrame(label='categories', value=df_cate, interactive=True)
34
  btn_classif = gr.Button("Categorize")
35
 
36
  with gr.Tab("Charts Generation"):
 
41
  plt_figure = gr.Plot()
42
 
43
  with gr.Tab("Chart Generation"):
44
+ gr.Markdown("## 🚧 Actuellement en maintenance 🚧")
45
  with gr.Tab("Overall"):
46
+ btn_overall = gr.Button("Overall Review")
47
  with gr.Tab("By Expert"):
48
  rd_exp=gr.Radio(["Satellite Networks / Nicolas", "Emergency Communication / Dorin", "Trend Analysis / Ly-Thanh", "Security Trust / Mireille", "Distributed Networks / Guillaume", "Network Security / Khawla", "USIM Management / Vincent", "Eco-Design / Pierre"], label="Expert Name")
49
  btn_expert = gr.Button("Top 10 by expert")
50
  with gr.Tab("By Company"):
51
  tb_com=gr.Textbox(label="Company Name",info="You can write 1, 2 or 3 company names at the same time")
52
+ btn_type = gr.Button("Company info")
53
  with gr.Row():
54
  plt_chart = gr.Plot(label="Graphique")
55
  plt_chart2 = gr.Plot(label="Graphique")
56
  plt_chart3 = gr.Plot(label="Graphique")
 
57
  with gr.Accordion("Excel Preview", open=False):
58
+ df_output = gr.DataFrame()
 
59
  fi_excel = gr.File(label="Excel File")
60
 
61
  fi_excel.change(get_columns, inputs=[fi_excel], outputs=[dd_source_ask, dd_source_class, dd_label1, dd_label2, df_output])
62
 
63
+ btn_extract.click(extractionPrincipale, inputs=[dd_url, fi_excel], outputs=[fi_excel, tb_message])
64
 
65
+ mist_button.click(chat_with_mistral, inputs=[dd_source_ask, tb_destcol, tb_prompt, tb_filename, fi_excel], outputs=[fi_excel, df_output])
66
 
67
+ btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category], outputs=[fi_excel, df_output])
68
 
69
  btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
70