tseronni commited on
Commit
9bf2fdf
·
1 Parent(s): 4299d62
Files changed (1) hide show
  1. app.py +22 -10
app.py CHANGED
@@ -1,22 +1,34 @@
1
  import gradio as gr
2
 
3
 
4
- def process_submit(semantic, zeroshot, abstract):
5
  return f"Test"
6
 
7
 
8
  semantic_models = ['all-mpnet-base-v2', 'msmarco-distilbert-dot-v5', 'distilbert-base-uncased', 'all-MiniLM-L6-v2', 'all-MiniLM-L12-v2', 'microsoft/mpnet-base']
9
  zeroshot_models = ['facebook/bart-large-mnli']
 
10
 
11
- iface = gr.Interface(
12
- fn=process_submit,
13
- inputs=[
14
- gr.Dropdown(choices=semantic_models, label="Select a semantic model", value='all-mpnet-base-v2'),
15
- gr.Dropdown(choices=zeroshot_models, label="Select a zeroshot model", value='facebook/bart-large-mnli'),
16
- gr.Textbox(lines=10, placeholder="Write here the patent abstract...", label="Patent Abstract")
17
- ],
18
- outputs="text"
19
- )
 
 
 
 
 
 
 
 
 
 
 
20
 
21
 
22
  if __name__ == "__main__":
 
1
  import gradio as gr
2
 
3
 
4
+ def process_submit(semantic, zeroshot, keywords_options, abstract):
5
  return f"Test"
6
 
7
 
8
  semantic_models = ['all-mpnet-base-v2', 'msmarco-distilbert-dot-v5', 'distilbert-base-uncased', 'all-MiniLM-L6-v2', 'all-MiniLM-L12-v2', 'microsoft/mpnet-base']
9
  zeroshot_models = ['facebook/bart-large-mnli']
10
+ extract_keywords_options = ['TF_IDF', 'Spacy Frequency', 'NLTK Frequency', 'NLTK RAKE']
11
 
12
+ with gr.Blocks() as iface:
13
+ with gr.Row():
14
+ with gr.Column(scale=7):
15
+ with gr.Row():
16
+ cmb_box_1 = gr.Dropdown(choices=semantic_models, label="Select a semantic model", value='all-mpnet-base-v2')
17
+ cmb_box_2 = gr.Dropdown(choices=zeroshot_models, label="Select a zeroshot model", value='facebook/bart-large-mnli')
18
+
19
+ txt_box_1 = gr.Textbox(lines=10, placeholder="Write here the patent abstract...", label="Patent Abstract")
20
+ btn_submit = gr.Button("Submit")
21
+
22
+ with gr.Column(scale=3):
23
+ with gr.Row():
24
+ cmb_box_3 = gr.Dropdown(choices=extract_keywords_options, label="Extract keywords method", value='TF_IDF')
25
+ output_text = gr.Text(label="Result")
26
+
27
+ btn_submit.click(
28
+ fn=process_submit,
29
+ inputs=[cmb_box_1, cmb_box_2, cmb_box_3, txt_box_1],
30
+ outputs=output_text
31
+ )
32
 
33
 
34
  if __name__ == "__main__":