epochs-demos commited on
Commit
dacba75
·
1 Parent(s): 6f57eb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -43
app.py CHANGED
@@ -3,43 +3,6 @@ import base64
3
  from gpt_reader.pdf_reader import PaperReader
4
  from gpt_reader.prompt import BASE_POINTS
5
 
6
- import base64
7
- import streamlit as st
8
-
9
- with open("./logo.png", "rb") as f:
10
- image_data = f.read()
11
- image_base64 = base64.b64encode(image_data).decode("utf-8")
12
-
13
- # Define the custom CSS styles
14
- header_css = """
15
- <style>
16
- .header img {
17
- margin-right: 10px;
18
- width: 80px;
19
- height: 50px;
20
- }
21
-
22
- .header p {
23
- font-size: 14px;
24
- }
25
- </style>
26
- """
27
-
28
- # Render the custom CSS
29
- st.markdown(header_css, unsafe_allow_html=True)
30
-
31
- # Render the header
32
- header_html = f"""
33
- <div class="header">
34
- <img src='data:image/png;base64,{image_base64}' alt="Logo"/>
35
- <p>Disclaimer: It is important to note that the purpose of this application is solely for demonstration purposes, showcasing the potential capabilities of AI systems. The information and results provided by the application should not be regarded as professional advice or a substitute for expert consultation in the relevant domain.
36
- . Contact: [email protected] for full solution.</p>
37
- </div>
38
- """
39
-
40
- # Render the header HTML
41
- st.markdown(header_html, unsafe_allow_html=True)
42
-
43
 
44
  class GUI:
45
  def __init__(self):
@@ -57,19 +20,20 @@ class GUI:
57
 
58
 
59
  with gr.Blocks() as demo:
60
-
 
 
 
61
 
62
  with gr.Tab("Upload PDF File"):
63
  pdf_input = gr.File(label="PDF File")
64
  api_input = gr.Textbox(label="OpenAI API Key")
65
  result = gr.Textbox(label="PDF Summary")
66
  upload_button = gr.Button("Start Analyse")
67
-
68
  with gr.Tab("Ask question about your PDF"):
69
  question_input = gr.Textbox(label="Your Question", placeholder="Authors of this paper?")
70
  answer = gr.Textbox(label="Answer")
71
  ask_button = gr.Button("Ask")
72
-
73
  with gr.Accordion("About this project"):
74
  gr.Markdown(
75
  """## CHATGPT-PAPER-READER📝
@@ -83,7 +47,5 @@ with gr.Blocks() as demo:
83
  ask_button.click(app.ask_question, inputs=question_input, outputs=answer)
84
 
85
  if __name__ == "__main__":
86
- iface = gr.Interface( title=title, description=description)
87
- iface.launch()
88
  demo.title = "CHATGPT-PAPER-READER"
89
- demo.launch()
 
3
  from gpt_reader.pdf_reader import PaperReader
4
  from gpt_reader.prompt import BASE_POINTS
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  class GUI:
8
  def __init__(self):
 
20
 
21
 
22
  with gr.Blocks() as demo:
23
+ gr.Markdown(
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")
31
  result = gr.Textbox(label="PDF Summary")
32
  upload_button = gr.Button("Start Analyse")
 
33
  with gr.Tab("Ask question about your PDF"):
34
  question_input = gr.Textbox(label="Your Question", placeholder="Authors of this paper?")
35
  answer = gr.Textbox(label="Answer")
36
  ask_button = gr.Button("Ask")
 
37
  with gr.Accordion("About this project"):
38
  gr.Markdown(
39
  """## CHATGPT-PAPER-READER📝
 
47
  ask_button.click(app.ask_question, inputs=question_input, outputs=answer)
48
 
49
  if __name__ == "__main__":
 
 
50
  demo.title = "CHATGPT-PAPER-READER"
51
+ demo.launch() # add "share=True" to share CHATGPT-PAPER-READER app on Internet. an app on hugging face