Create interface.py
Browse files- interface.py +32 -0
interface.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Gradio application setup
|
| 4 |
+
def create_demo():
|
| 5 |
+
with gr.Blocks(title= "RAG Chatbot Q&A",
|
| 6 |
+
theme = "Soft"
|
| 7 |
+
) as demo:
|
| 8 |
+
with gr.Column():
|
| 9 |
+
with gr.Row():
|
| 10 |
+
chat_history = gr.Chatbot(value=[], elem_id='chatbot', height=680)
|
| 11 |
+
show_img = gr.Image(label='Overview', height=680)
|
| 12 |
+
|
| 13 |
+
with gr.Row():
|
| 14 |
+
with gr.Column(scale=0.60):
|
| 15 |
+
text_input = gr.Textbox(
|
| 16 |
+
show_label=False,
|
| 17 |
+
placeholder="Type here to ask your PDF",
|
| 18 |
+
container=False)
|
| 19 |
+
|
| 20 |
+
with gr.Column(scale=0.20):
|
| 21 |
+
submit_button = gr.Button('Send')
|
| 22 |
+
|
| 23 |
+
with gr.Column(scale=0.20):
|
| 24 |
+
uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"])
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf
|
| 28 |
+
|
| 29 |
+
if __name__ == '__main__':
|
| 30 |
+
demo, chatbot, show_img, text_input, submit_button, uploaded_pdf = create_demo()
|
| 31 |
+
demo.queue()
|
| 32 |
+
demo.launch()
|