Spaces:
Sleeping
Sleeping
Commit
·
a4f64ec
1
Parent(s):
0dc803c
test cv extraction
Browse files
app.py
CHANGED
@@ -104,32 +104,24 @@ def LLM_Inference(cv_text):
|
|
104 |
)
|
105 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
# Create Gradio App
|
108 |
-
|
109 |
-
fn=
|
110 |
inputs=gr.File(label="Upload a PDF file"),
|
111 |
-
outputs
|
112 |
-
|
113 |
-
gr.
|
114 |
-
|
115 |
title="PDF Processor",
|
116 |
description="Upload a PDF file and extract its content."
|
117 |
)
|
118 |
|
119 |
-
# Create Gradio interface for Hugging Face inference
|
120 |
-
llm_interface = gr.Interface(
|
121 |
-
fn=LLM_Inference,
|
122 |
-
inputs=gr.State(),
|
123 |
-
outputs=gr.Textbox(label="Hugging Face Output"),
|
124 |
-
title="Hugging Face Query",
|
125 |
-
description="Enter a query and get a response from the Hugging Face model."
|
126 |
-
)
|
127 |
|
128 |
-
# Combine both interfaces into a tabbed app
|
129 |
-
interface = gr.TabbedInterface(
|
130 |
-
interface_list=[pdf_interface, llm_interface],
|
131 |
-
tab_names=["PDF Processor", "Hugging Face Query"]
|
132 |
-
)
|
133 |
# Launch the Gradio App
|
134 |
if __name__ == "__main__":
|
135 |
prepare()
|
|
|
104 |
)
|
105 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
106 |
|
107 |
+
def process(file_path):
|
108 |
+
cv_text = read_pdf(file_path)
|
109 |
+
cv_summary = LLM_Inference(cv_text)
|
110 |
+
return cv_text, cv_summary
|
111 |
+
|
112 |
# Create Gradio App
|
113 |
+
interface = gr.Interface(
|
114 |
+
fn=process,
|
115 |
inputs=gr.File(label="Upload a PDF file"),
|
116 |
+
outputs=[
|
117 |
+
gr.Textbox(label="PDF Content"), # Display PDF content
|
118 |
+
gr.Textbox(label="CV Summary"),
|
119 |
+
],
|
120 |
title="PDF Processor",
|
121 |
description="Upload a PDF file and extract its content."
|
122 |
)
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
# Launch the Gradio App
|
126 |
if __name__ == "__main__":
|
127 |
prepare()
|