Spaces:
Runtime error
Runtime error
Commit ·
a4ab9a0
1
Parent(s): c6bd56e
Update app.py
Browse files
app.py
CHANGED
|
@@ -254,6 +254,19 @@ def pdfv3(in1, in2):
|
|
| 254 |
|
| 255 |
return 'ok!!'
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
|
| 258 |
with gr.Blocks() as demo:
|
| 259 |
gr.Markdown(
|
|
@@ -280,6 +293,7 @@ with gr.Blocks() as demo:
|
|
| 280 |
outIndex1 = gr.File(label="IndexJson", interactive=True)
|
| 281 |
inp1.change(pdfv1, inputs=[inp1,chainType1], outputs=[out1, outIndex1])
|
| 282 |
doSum1.click(pdfv1, inputs=[inp1,chainType1], outputs=[out1, outIndex1])
|
|
|
|
| 283 |
gr.Markdown("""# Q&A""")
|
| 284 |
question1 = gr.Textbox(label="Question related to the pdf", placeholder = "Question...")
|
| 285 |
gr.Examples(
|
|
|
|
| 254 |
|
| 255 |
return 'ok!!'
|
| 256 |
|
| 257 |
+
def storeIndex1(file):
|
| 258 |
+
newPath = home_path
|
| 259 |
+
new_name = 'index1'
|
| 260 |
+
ext = 'json'
|
| 261 |
+
# # Separate file name and extension
|
| 262 |
+
# name, ext = os.path.splitext(files.name)
|
| 263 |
+
# # Concatenate new name and original extension
|
| 264 |
+
new_path = os.path.join(newPath, new_name + ext)
|
| 265 |
+
# Move file to new location with new name
|
| 266 |
+
print(files.name)
|
| 267 |
+
os.rename(files.name, new_path)
|
| 268 |
+
return
|
| 269 |
+
|
| 270 |
|
| 271 |
with gr.Blocks() as demo:
|
| 272 |
gr.Markdown(
|
|
|
|
| 293 |
outIndex1 = gr.File(label="IndexJson", interactive=True)
|
| 294 |
inp1.change(pdfv1, inputs=[inp1,chainType1], outputs=[out1, outIndex1])
|
| 295 |
doSum1.click(pdfv1, inputs=[inp1,chainType1], outputs=[out1, outIndex1])
|
| 296 |
+
outIndex1.change(storeIndex1, inp1)
|
| 297 |
gr.Markdown("""# Q&A""")
|
| 298 |
question1 = gr.Textbox(label="Question related to the pdf", placeholder = "Question...")
|
| 299 |
gr.Examples(
|