gradsyntax commited on
Commit
bf3a139
Β·
verified Β·
1 Parent(s): 3ff93bf

created app py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from utils import get_summary, check_grammar, detect_plagiarism
3
+
4
+ def summarize_paper(text):
5
+ return get_summary(text)
6
+
7
+ def generate_title(abstract):
8
+ # You can plug in a title generation model here
9
+ return "Generated Title Placeholder"
10
+
11
+ def correct_grammar(text):
12
+ return check_grammar(text)
13
+
14
+ def check_similarity(text1, text2):
15
+ return detect_plagiarism(text1, text2)
16
+
17
+ with gr.Blocks(title="Research Assistant") as demo:
18
+ gr.Markdown("# Research Paper Assistant")
19
+
20
+ with gr.Tab("Summarize"):
21
+ input1 = gr.Textbox(lines=10, label="Paste paper abstract or content")
22
+ output1 = gr.Textbox(label="Summary")
23
+ btn1 = gr.Button("Summarize")
24
+ btn1.click(fn=summarize_paper, inputs=input1, outputs=output1)
25
+
26
+ with gr.Tab("Title Generator"):
27
+ input2 = gr.Textbox(lines=5, label="Abstract")
28
+ output2 = gr.Textbox(label="Suggested Title")
29
+ btn2 = gr.Button("Generate Title")
30
+ btn2.click(fn=generate_title, inputs=input2, outputs=output2)
31
+
32
+ with gr.Tab("Grammar Checker"):
33
+ input3 = gr.Textbox(lines=8, label="Text to Check")
34
+ output3 = gr.Textbox(label="Corrected Text")
35
+ btn3 = gr.Button("Check Grammar")
36
+ btn3.click(fn=correct_grammar, inputs=input3, outputs=output3)
37
+
38
+ with gr.Tab("Plagiarism Checker"):
39
+ input4a = gr.Textbox(lines=5, label="Original Text")
40
+ input4b = gr.Textbox(lines=5, label="Submitted Text")
41
+ output4 = gr.Textbox(label="Similarity Score")
42
+ btn4 = gr.Button("Compare")
43
+ btn4.click(fn=check_similarity, inputs=[input4a, input4b], outputs=output4)
44
+
45
+ demo.launch()