coldlarry commited on
Commit
bc76e36
·
1 Parent(s): c1555c6
Files changed (1) hide show
  1. app.py +24 -4
app.py CHANGED
@@ -1,7 +1,27 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ with gr.Blocks() as demo:
4
+ gr.Markdown(
5
+ """
6
+ # CHATGPT-PAPER-READER
7
+ [点击此处以支付 $5 成为我们的会员](https://checkout.stripe.com/c/pay/cs_live_a1TwwqhUpsfstnbyiAvbMoXvMzoaII5vskE8tz1cIsMSYUt9hJvoHK2qOK#fidkdWxOYHwnPyd1blppbHNgWjA0TlZXUHNAck9nTWNdXVc1TDRxTXIzQGo9b383N11yfDBhMzBvZ0pAMlNURDBBVWpiMHJObkhkSUZQSktwaWZ9S1dqUzFRRDw0f1dSa0dAQmp%2FYk5TS2tQNTVHa1F1RlVvPCcpJ3VpbGtuQH11anZgYUxhJz8nZEBQZko9MWRMPDxEYUNOZkhIJ3gl)
8
+ """)
9
 
10
+ with gr.Tab("Upload PDF File"):
11
+ pdf_input = gr.File(label="PDF File")
12
+ api_input = gr.Textbox(label="OpenAI API Key")
13
+ #result = gr.Textbox(label="PDF Summary")
14
+ upload_button = gr.Button("Start Analyse")
15
+ with gr.Tab("Ask question about your PDF") as my:
16
+ my.launch(auth = ('user','admin'), auth_message= "Enter your username and password that you received in on Slack")
17
+ question_input = gr.Textbox(label="Your Question", placeholder="Authors of this paper?")
18
+ answer = gr.Textbox(label="Answer")
19
+ ask_button = gr.Button("Ask")
20
+
21
+ app = GUI()
22
+ upload_button.click(fn=app.pdf_init, inputs=[api_input, pdf_input])
23
+ ask_button.click(app.get_answer, inputs=question_input, outputs=answer)
24
+
25
+ if __name__ == "__main__":
26
+ demo.title = "CHATGPT-PAPER-READER"
27
+ demo.launch() # add "share=True" to share CHATGPT-PAPER-READER app on Internet.