Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
def
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
)
|
11 |
|
12 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
|
3 |
+
def process_input(message, pdf_file):
|
4 |
+
print("Received Message:", message)
|
5 |
+
print("Received PDF File:", pdf_file.name)
|
6 |
+
|
7 |
+
# Save the received PDF file
|
8 |
+
with open("received_pdf.pdf", "wb") as output_file:
|
9 |
+
output_file.write(pdf_file.read())
|
10 |
+
|
11 |
+
return "Processing complete. Check the console for details."
|
12 |
+
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=process_input,
|
15 |
+
inputs=[
|
16 |
+
"text",
|
17 |
+
gr.File(
|
18 |
+
type="pdf",
|
19 |
+
label="Please upload a PDF file that contains an abstract. You will receive a one-sentence summary of the PDF and can listen to it.",
|
20 |
+
),
|
21 |
+
],
|
22 |
+
outputs="text",
|
23 |
)
|
24 |
|
25 |
+
iface.launch()
|