Spaces:
Runtime error
Runtime error
Back to Normal
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ def doc_emb(doc: str):
|
|
| 46 |
# for f in futures:
|
| 47 |
# emb_list.append(f.result())
|
| 48 |
print('\n'.join(texts))
|
| 49 |
-
return texts, emb_list, gr.Textbox.update(visible=
|
| 50 |
value="""success ! Let's talk"""), gr.Chatbot.update(visible=True)
|
| 51 |
|
| 52 |
|
|
@@ -147,38 +147,23 @@ def up_file(files):
|
|
| 147 |
value="Processing")
|
| 148 |
|
| 149 |
|
| 150 |
-
with gr.Blocks(css=".gradio-container {background-color:
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column():
|
| 153 |
file = gr.File(file_types=['.pdf'], label='Click to upload Document', file_count='multiple')
|
| 154 |
doc_bu = gr.Button(value='Submit', visible=False)
|
| 155 |
-
|
| 156 |
-
|
| 157 |
txt = gr.Textbox(label='result', visible=False)
|
| 158 |
-
|
| 159 |
-
|
| 160 |
doc_text_state = gr.State([])
|
| 161 |
doc_emb_state = gr.State([])
|
| 162 |
with gr.Column():
|
| 163 |
md = gr.Markdown("Please Upload the PDF")
|
| 164 |
chat_bot = gr.Chatbot(visible=False)
|
| 165 |
-
msg_txt = gr.Textbox(label='Ask Questions', placeholder='write',visible
|
| 166 |
-
chat_bu = gr.Button(value='
|
| 167 |
|
| 168 |
-
file.change(up_file, [file], [txt, doc_bu, md])
|
| 169 |
doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
|
| 170 |
-
|
| 171 |
-
chat_bu.click(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot])
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
# msg_txt = gr.Textbox(label='Ask Questions', placeholder='write', visible=False)
|
| 175 |
-
# chat_bu = gr.Button(value='Proceed', visible=False)
|
| 176 |
-
|
| 177 |
-
# file.change(up_file, [file], [txt, doc_bu, md])
|
| 178 |
-
# doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
|
| 179 |
-
# chat_bu.click(get_response, [msg_txt, chat_bot, doc_text_state, doc_emb_state], [chat_bot])
|
| 180 |
-
|
| 181 |
-
|
| 182 |
|
| 183 |
if __name__ == "__main__":
|
| 184 |
demo.queue().launch()
|
|
|
|
| 46 |
# for f in futures:
|
| 47 |
# emb_list.append(f.result())
|
| 48 |
print('\n'.join(texts))
|
| 49 |
+
return texts, emb_list, gr.Textbox.update(visible=True), gr.Button.update(visible=True), gr.Markdown.update(
|
| 50 |
value="""success ! Let's talk"""), gr.Chatbot.update(visible=True)
|
| 51 |
|
| 52 |
|
|
|
|
| 147 |
value="Processing")
|
| 148 |
|
| 149 |
|
| 150 |
+
with gr.Blocks(css=".gradio-container {background-color: red}) as demo:
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column():
|
| 153 |
file = gr.File(file_types=['.pdf'], label='Click to upload Document', file_count='multiple')
|
| 154 |
doc_bu = gr.Button(value='Submit', visible=False)
|
|
|
|
|
|
|
| 155 |
txt = gr.Textbox(label='result', visible=False)
|
|
|
|
|
|
|
| 156 |
doc_text_state = gr.State([])
|
| 157 |
doc_emb_state = gr.State([])
|
| 158 |
with gr.Column():
|
| 159 |
md = gr.Markdown("Please Upload the PDF")
|
| 160 |
chat_bot = gr.Chatbot(visible=False)
|
| 161 |
+
msg_txt = gr.Textbox(label='Ask Questions', placeholder='write', visible=False)
|
| 162 |
+
chat_bu = gr.Button(value='Proceed', visible=False)
|
| 163 |
|
| 164 |
+
file.change(up_file, [file], [txt, doc_bu, md])
|
| 165 |
doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
|
| 166 |
+
chat_bu.click(get_response, [msg_txt, chat_bot, doc_text_state, doc_emb_state], [chat_bot])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
if __name__ == "__main__":
|
| 169 |
demo.queue().launch()
|