YchKhan commited on
Commit
efa9b10
1 Parent(s): 691ae9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py CHANGED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from scrape_3gpp.py import *
3
+ from excel_chat.py import *
4
+ from classification.py import *
5
+
6
+
7
+ with gr.Blocks() as demo:
8
+ gr.Markdown("## Extaction, Classification and AI tool")
9
+ with gr.Tab("File extraction"):
10
+ gr.Markdown(" Put either just a link, or a link and an excel file with an 'Actions' column")
11
+ tb_url = gr.Textbox(label="URL (e.g. https://www.3gpp.org/ftp/TSG_SA/WG1_Serv/TSGS1_105_Athens/Docs)")
12
+ btn_extract = gr.Button("Extract excel from URL")
13
+ status_message = gr.Textbox(label="Status")
14
+
15
+ with gr.Tab("Query on columns with mistral"):
16
+ dd_source = gr.Dropdown(label="Source Column(s)", multiselect=True)
17
+ tb_destcol = gr.Textbox(label="Destination column label (e.g. Summary, ELI5, PAB)")
18
+ tb_prompt = gr.Textbox(label="Prompt")
19
+ tb_filename = gr.Textbox(label="Specific File Name (Optional)")
20
+ mist_button = gr.Button("Ask AI")
21
+
22
+ with gr.Tab("Classification by topic"):
23
+ dd_source = gr.Dropdown(label="Source Column(s)", multiselect=False)
24
+ classif = gr.Button("Categorize")
25
+
26
+ with gr.Accordion("Excel Preview", open=False):
27
+ df_output = gr.DataFrame()
28
+
29
+ fi_excel = gr.File(label="Excel File")
30
+
31
+ fi_excel.change(get_columns, inputs=[fi_excel], outputs=[dd_source, df_output])
32
+ btn_extract.click(extractionPrincipale, inputs=[tb_url, fi_excel], outputs=[fi_excel, status_message])
33
+ mist_button.click(chat_with_mistral, inputs=[dd_source, tb_destcol, tb_prompt, tb_filename, fi_excel, tb_url], outputs=[fi_excel, df_output])
34
+ classif.click(classification, inputs=[dd_source, fi_excel], outputs=[fi_excel, df_output])
35
+
36
+
37
+ demo.launch(debug=True)