Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,47 +31,6 @@ def pdfSummarizer(gemini_api_key, pdf_file, kind):
|
|
31 |
|
32 |
return response.text
|
33 |
|
34 |
-
# write summarizer alert function
|
35 |
-
def sumAlert():
|
36 |
-
gr.HTML("""
|
37 |
-
<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js'></script>
|
38 |
-
<link href='https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.css' rel='stylesheet'>
|
39 |
-
""")
|
40 |
-
gr.HTML("""
|
41 |
-
<style>
|
42 |
-
.prompt-title {
|
43 |
-
font-family: "JetBrains Mono",monospace;
|
44 |
-
color: "white";
|
45 |
-
}
|
46 |
-
|
47 |
-
.prompt-popup {
|
48 |
-
background: #646566;
|
49 |
-
color:white;
|
50 |
-
border-radius:15px;
|
51 |
-
}
|
52 |
-
</style>
|
53 |
-
<div style="text-align:center;">
|
54 |
-
<button onclick=infoAlert()
|
55 |
-
style="padding: 15px; background-color: #646566; font-family: 'JetBrains Mono',monospace; color: white; border: none; border-radius: 15px; cursor: pointer;">
|
56 |
-
Info
|
57 |
-
</button>
|
58 |
-
<script>
|
59 |
-
function infoAlert(){
|
60 |
-
Swal.fire({
|
61 |
-
text: "Summarizing. . .",
|
62 |
-
confirmButtonColor: "black",
|
63 |
-
position: "bottom-right",
|
64 |
-
customClass: {
|
65 |
-
title: "prompt-title",
|
66 |
-
popup: "prompt-popup"
|
67 |
-
},
|
68 |
-
timer: 7000
|
69 |
-
});
|
70 |
-
}
|
71 |
-
</script>
|
72 |
-
</div>
|
73 |
-
""")
|
74 |
-
|
75 |
with gr.Blocks(
|
76 |
theme="upsatwal/mlsc_tiet",
|
77 |
analytics_enabled=True,
|
@@ -137,10 +96,9 @@ with gr.Blocks(
|
|
137 |
|
138 |
with gr.Column():
|
139 |
gr.HTML("<div style='text-align:center;overflow:hidden;'><h2>Summary Output</h2></div>")
|
140 |
-
out = gr.Markdown()
|
141 |
|
142 |
btn.click(fn=pdfSummarizer, inputs=[api_key, pdf_input, summary_type], outputs=out)
|
143 |
-
btn.click(fn=sumAlert,inputs="",outputs="")
|
144 |
clear_btn.click(lambda: [None,None,"5 Bullet Points",""],inputs=None,outputs=[api_key, pdf_input, summary_type, out],queue=False)
|
145 |
|
146 |
app.launch(pwa=True)
|
|
|
31 |
|
32 |
return response.text
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
with gr.Blocks(
|
35 |
theme="upsatwal/mlsc_tiet",
|
36 |
analytics_enabled=True,
|
|
|
96 |
|
97 |
with gr.Column():
|
98 |
gr.HTML("<div style='text-align:center;overflow:hidden;'><h2>Summary Output</h2></div>")
|
99 |
+
out = gr.Markdown(height=100)
|
100 |
|
101 |
btn.click(fn=pdfSummarizer, inputs=[api_key, pdf_input, summary_type], outputs=out)
|
|
|
102 |
clear_btn.click(lambda: [None,None,"5 Bullet Points",""],inputs=None,outputs=[api_key, pdf_input, summary_type, out],queue=False)
|
103 |
|
104 |
app.launch(pwa=True)
|