Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,16 @@ import gradio as gr
|
|
| 2 |
from PyPDF2 import PdfReader
|
| 3 |
import os
|
| 4 |
from docx import Document as DocxDocument
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def process_pdf(file):
|
| 7 |
# Read the PDF content
|
| 8 |
pdf_reader = PdfReader(file.name)
|
|
@@ -27,9 +36,6 @@ def process_file(file):
|
|
| 27 |
return text
|
| 28 |
#return [Document(text=text)]
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
with gr.Blocks() as demo:
|
| 34 |
gr.Markdown("### File upload", elem_classes="tab-header")
|
| 35 |
with gr.Row():
|
|
|
|
| 2 |
from PyPDF2 import PdfReader
|
| 3 |
import os
|
| 4 |
from docx import Document as DocxDocument
|
| 5 |
+
from gradio_client import Client
|
| 6 |
+
|
| 7 |
+
def routing(message):
|
| 8 |
+
client = Client("mgokg/SemanticRouting")
|
| 9 |
+
result = client.predict(
|
| 10 |
+
prompt=f"{message}",
|
| 11 |
+
api_name="/predict"
|
| 12 |
+
)
|
| 13 |
+
return result
|
| 14 |
+
|
| 15 |
def process_pdf(file):
|
| 16 |
# Read the PDF content
|
| 17 |
pdf_reader = PdfReader(file.name)
|
|
|
|
| 36 |
return text
|
| 37 |
#return [Document(text=text)]
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
with gr.Blocks() as demo:
|
| 40 |
gr.Markdown("### File upload", elem_classes="tab-header")
|
| 41 |
with gr.Row():
|