Spaces:
Runtime error
Runtime error
Commit
·
825073b
1
Parent(s):
6811e93
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
from gpt_reader.pdf_reader import PaperReader
|
| 4 |
from gpt_reader.prompt import BASE_POINTS
|
| 5 |
|
|
@@ -18,13 +18,31 @@ class GUI:
|
|
| 18 |
return "Please upload PDF file first!"
|
| 19 |
return self.session.question(question)
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
-
gr.
|
| 24 |
-
|
| 25 |
-
# CHATGPT-PAPER-READER
|
| 26 |
-
""")
|
| 27 |
-
|
| 28 |
with gr.Tab("Upload PDF File"):
|
| 29 |
pdf_input = gr.File(label="PDF File")
|
| 30 |
api_input = gr.Textbox(label="OpenAI API Key")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import base64
|
| 3 |
from gpt_reader.pdf_reader import PaperReader
|
| 4 |
from gpt_reader.prompt import BASE_POINTS
|
| 5 |
|
|
|
|
| 18 |
return "Please upload PDF file first!"
|
| 19 |
return self.session.question(question)
|
| 20 |
|
| 21 |
+
with open("./logo.png", "rb") as f:
|
| 22 |
+
image_data = f.read()
|
| 23 |
+
image_base64 = base64.b64encode(image_data).decode("utf-8")
|
| 24 |
+
title = f"""
|
| 25 |
+
<h2 style="background-image: linear-gradient(to right, #3A5FCD, #87CEFA); -webkit-background-clip: text;
|
| 26 |
+
-webkit-text-fill-color: transparent; text-align: center;">
|
| 27 |
+
ChatPDF-GUI
|
| 28 |
+
</h2>
|
| 29 |
+
"""
|
| 30 |
+
description = f"""
|
| 31 |
+
<div style="display: flex; align-items: center; justify-content: center; flex-direction: column;">
|
| 32 |
+
<p style="font-size: 18px; color: #4AAAFF; text-align: center;">
|
| 33 |
+
Upload your pdf and let our model read it to you!"
|
| 34 |
+
</p>
|
| 35 |
+
<div style="display: flex; align-items: center; margin-bottom: 0px;">
|
| 36 |
+
<img src='data:image/jpeg;base64,{image_base64}' width='50' height='30' style="margin-right: 5px;"/>
|
| 37 |
+
<p style="font-size: 14px; color: #555;">
|
| 38 |
+
Disclaimer: The purpose of this application is solely for demonstration. 1001epochs does not claim ownership for the results. Contact: contact@1001epochs.co.uk for full solution.
|
| 39 |
+
</p>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
"""
|
| 43 |
with gr.Blocks() as demo:
|
| 44 |
+
gr.HTML(title)
|
| 45 |
+
gr.HTML(description)
|
|
|
|
|
|
|
|
|
|
| 46 |
with gr.Tab("Upload PDF File"):
|
| 47 |
pdf_input = gr.File(label="PDF File")
|
| 48 |
api_input = gr.Textbox(label="OpenAI API Key")
|