Update app.py
Browse files
app.py
CHANGED
@@ -137,7 +137,7 @@ def create_gradio_interface():
|
|
137 |
|
138 |
def process_and_display(file, prompt, output_format):
|
139 |
def processing_task():
|
140 |
-
file_content = file
|
141 |
file_type = infer_file_type(file_content)
|
142 |
results = processor.process_document(file_content, file_type, prompt)
|
143 |
|
@@ -162,7 +162,7 @@ def create_gradio_interface():
|
|
162 |
iface = gr.Interface(
|
163 |
fn=process_and_display,
|
164 |
inputs=[
|
165 |
-
gr.File(label="Upload Document (PDF, DOCX, or TXT)"
|
166 |
gr.Textbox(label="Enter your prompt for processing", lines=3),
|
167 |
gr.Radio(["txt", "docx", "pdf"], label="Output Format", value="txt")
|
168 |
],
|
@@ -218,10 +218,4 @@ def save_as_pdf(results: Dict[str, str]) -> str:
|
|
218 |
# Launch the Gradio app
|
219 |
if __name__ == "__main__":
|
220 |
iface = create_gradio_interface()
|
221 |
-
iface.launch()
|
222 |
-
|
223 |
-
|
224 |
-
# Launch the Gradio app
|
225 |
-
if __name__ == "__main__":
|
226 |
-
iface = create_gradio_interface()
|
227 |
-
iface.launch()
|
|
|
137 |
|
138 |
def process_and_display(file, prompt, output_format):
|
139 |
def processing_task():
|
140 |
+
file_content = file.read() # Read file content
|
141 |
file_type = infer_file_type(file_content)
|
142 |
results = processor.process_document(file_content, file_type, prompt)
|
143 |
|
|
|
162 |
iface = gr.Interface(
|
163 |
fn=process_and_display,
|
164 |
inputs=[
|
165 |
+
gr.File(label="Upload Document (PDF, DOCX, or TXT)"),
|
166 |
gr.Textbox(label="Enter your prompt for processing", lines=3),
|
167 |
gr.Radio(["txt", "docx", "pdf"], label="Output Format", value="txt")
|
168 |
],
|
|
|
218 |
# Launch the Gradio app
|
219 |
if __name__ == "__main__":
|
220 |
iface = create_gradio_interface()
|
221 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|