Spaces:
Runtime error
Runtime error
on1onmangoes
commited on
Commit
•
6388b89
1
Parent(s):
c3f14a1
Update app.py
Browse files
app.py
CHANGED
@@ -113,6 +113,7 @@ def format_relevant_documents(relevant_docs: list):
|
|
113 |
return formatted_docs.strip()
|
114 |
|
115 |
|
|
|
116 |
# Function to handle PDF processing API call
|
117 |
def process_pdf(pdf_file, client_name):
|
118 |
return client.predict(
|
@@ -133,6 +134,11 @@ def delete_index():
|
|
133 |
result = client.predict(api_name="/delete_index")
|
134 |
return result
|
135 |
|
|
|
|
|
|
|
|
|
|
|
136 |
# CSS for custom styling
|
137 |
CSS = """
|
138 |
# chat-container {
|
@@ -222,7 +228,12 @@ with gr.Blocks(css=CSS) as demo:
|
|
222 |
),
|
223 |
],
|
224 |
)
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
with gr.Tab("Process PDF"):
|
228 |
pdf_input = gr.File(label="Upload PDF File")
|
|
|
113 |
return formatted_docs.strip()
|
114 |
|
115 |
|
116 |
+
# ------------------------------------- Core CNI APP ----------------------------------------------------------------------------------
|
117 |
# Function to handle PDF processing API call
|
118 |
def process_pdf(pdf_file, client_name):
|
119 |
return client.predict(
|
|
|
134 |
result = client.predict(api_name="/delete_index")
|
135 |
return result
|
136 |
|
137 |
+
|
138 |
+
#-------------------------------------- View PDF ----------------------------------------------------------------------------------
|
139 |
+
def view_pdf:
|
140 |
+
|
141 |
+
|
142 |
# CSS for custom styling
|
143 |
CSS = """
|
144 |
# chat-container {
|
|
|
228 |
),
|
229 |
],
|
230 |
)
|
231 |
+
|
232 |
+
with gr.Tab ("View PDF"):
|
233 |
+
pdf = PDF(label="Upload a PDF", interactive=True)
|
234 |
+
name = gr.Textbox()
|
235 |
+
#pdf.upload(lambda f: f, pdf, name)
|
236 |
+
pdf.upload(fn=view_pdf_name, inputs=[pdf], outputs=[pdf,name], api_name = "view_pdf_name")
|
237 |
|
238 |
with gr.Tab("Process PDF"):
|
239 |
pdf_input = gr.File(label="Upload PDF File")
|