Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def predict_pptx_content(file_path):
|
|
33 |
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
-
summary = summarizer(extracted_text, max_length=
|
37 |
|
38 |
return {
|
39 |
"predicted_label": predicted_label,
|
@@ -42,14 +42,14 @@ def predict_pptx_content(file_path):
|
|
42 |
}
|
43 |
|
44 |
except Exception as e:
|
|
|
45 |
print(f"Error in predict_pptx_content: {e}")
|
46 |
return {"error": str(e)}
|
47 |
|
48 |
-
|
49 |
# Define the Gradio interface
|
50 |
iface = gr.Interface(
|
51 |
fn=predict_pptx_content,
|
52 |
-
inputs=gr.File(type="
|
53 |
outputs=[
|
54 |
gr.Textbox("Predicted Label"),
|
55 |
gr.Textbox("Evaluation"),
|
@@ -60,4 +60,4 @@ iface = gr.Interface(
|
|
60 |
)
|
61 |
|
62 |
# Deploy the Gradio interface
|
63 |
-
iface.launch(share=True)
|
|
|
33 |
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
+
summary = summarizer(extracted_text, max_length=80, min_length=30, do_sample=False)[0]['summary_text']
|
37 |
|
38 |
return {
|
39 |
"predicted_label": predicted_label,
|
|
|
42 |
}
|
43 |
|
44 |
except Exception as e:
|
45 |
+
# Log the error details
|
46 |
print(f"Error in predict_pptx_content: {e}")
|
47 |
return {"error": str(e)}
|
48 |
|
|
|
49 |
# Define the Gradio interface
|
50 |
iface = gr.Interface(
|
51 |
fn=predict_pptx_content,
|
52 |
+
inputs=gr.File(type="file", label="Upload PowerPoint (.pptx) file"),
|
53 |
outputs=[
|
54 |
gr.Textbox("Predicted Label"),
|
55 |
gr.Textbox("Evaluation"),
|
|
|
60 |
)
|
61 |
|
62 |
# Deploy the Gradio interface
|
63 |
+
iface.launch(share=True)
|