- interface.py +21 -10
interface.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
css="""
|
| 4 |
-
#col-container {max-width:
|
| 5 |
"""
|
| 6 |
|
| 7 |
# title = """
|
|
@@ -80,7 +80,14 @@ def _create_demo():
|
|
| 80 |
|
| 81 |
return demo, api_key, change_api_key, chatbot, show_img, text_input, submit_btn, upload_btn
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
def create_demo():
|
| 85 |
'''
|
| 86 |
Interface with no api component
|
|
@@ -94,8 +101,17 @@ def create_demo():
|
|
| 94 |
nothing = gr.Button('This is sidebar')
|
| 95 |
# Create a Gradio block
|
| 96 |
with gr.Column(elem_id="col-container"):
|
|
|
|
| 97 |
gr.HTML(title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
|
|
|
| 99 |
with gr.Column():
|
| 100 |
# with gr.Row():
|
| 101 |
# with gr.Column(scale=0.8):
|
|
@@ -108,12 +124,7 @@ def create_demo():
|
|
| 108 |
# with gr.Column(scale=0.2):
|
| 109 |
# change_api_key = gr.Button('Update API Key',interactive = False)
|
| 110 |
|
| 111 |
-
|
| 112 |
-
with gr.Column(scale=1):
|
| 113 |
-
upload_btn = gr.UploadButton("π Upload PDF", file_types=[".pdf"],scale=0.9)
|
| 114 |
-
sidebar_state = gr.State(False)
|
| 115 |
-
toggle_sidebar_btn = gr.Button("π«΅")
|
| 116 |
-
toggle_sidebar_btn.click(toggle_sidebar, [sidebar_state], [sidebar, sidebar_state])
|
| 117 |
|
| 118 |
|
| 119 |
with gr.Row():
|
|
@@ -128,10 +139,10 @@ def create_demo():
|
|
| 128 |
text_input = gr.Textbox(
|
| 129 |
show_label=False,
|
| 130 |
placeholder="Ask your pdf?",
|
| 131 |
-
container=False,scale=
|
| 132 |
|
| 133 |
|
| 134 |
-
submit_btn = gr.Button('π',scale=
|
| 135 |
|
| 136 |
|
| 137 |
return demo, chatbot, show_img, text_input, submit_btn, upload_btn
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
css="""
|
| 4 |
+
#col-container {max-width: 1400px; margin-left: auto; margin-right: auto;}
|
| 5 |
"""
|
| 6 |
|
| 7 |
# title = """
|
|
|
|
| 80 |
|
| 81 |
return demo, api_key, change_api_key, chatbot, show_img, text_input, submit_btn, upload_btn
|
| 82 |
|
| 83 |
+
smbtn_css = """
|
| 84 |
+
#small_btn {
|
| 85 |
+
margin: 0.6em 0em 0.55em 0;
|
| 86 |
+
max-width: 1em;
|
| 87 |
+
min-width: 1em !important;
|
| 88 |
+
height: 1em;
|
| 89 |
+
}
|
| 90 |
+
"""
|
| 91 |
def create_demo():
|
| 92 |
'''
|
| 93 |
Interface with no api component
|
|
|
|
| 101 |
nothing = gr.Button('This is sidebar')
|
| 102 |
# Create a Gradio block
|
| 103 |
with gr.Column(elem_id="col-container"):
|
| 104 |
+
|
| 105 |
gr.HTML(title)
|
| 106 |
+
|
| 107 |
+
with gr.Row():
|
| 108 |
+
sidebar_state = gr.State(False)
|
| 109 |
+
toggle_sidebar_btn = gr.Button(">>",size='sm',scale=1)
|
| 110 |
+
toggle_sidebar_btn.click(toggle_sidebar, [sidebar_state], [sidebar, sidebar_state])
|
| 111 |
+
|
| 112 |
+
upload_btn = gr.UploadButton("π Upload PDF", file_types=[".pdf"],scale=9)
|
| 113 |
|
| 114 |
+
|
| 115 |
with gr.Column():
|
| 116 |
# with gr.Row():
|
| 117 |
# with gr.Column(scale=0.8):
|
|
|
|
| 124 |
# with gr.Column(scale=0.2):
|
| 125 |
# change_api_key = gr.Button('Update API Key',interactive = False)
|
| 126 |
|
| 127 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
|
| 130 |
with gr.Row():
|
|
|
|
| 139 |
text_input = gr.Textbox(
|
| 140 |
show_label=False,
|
| 141 |
placeholder="Ask your pdf?",
|
| 142 |
+
container=False,scale=8)
|
| 143 |
|
| 144 |
|
| 145 |
+
submit_btn = gr.Button('π',scale=1)
|
| 146 |
|
| 147 |
|
| 148 |
return demo, chatbot, show_img, text_input, submit_btn, upload_btn
|