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