Update app.py
Browse files
app.py
CHANGED
|
@@ -33,24 +33,19 @@ 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,
|
| 40 |
"evaluation": predicted_probability,
|
| 41 |
"summary": summary
|
| 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 |
-
except Exception as e:
|
| 50 |
-
# Log the error details
|
| 51 |
print(f"Error in predict_pptx_content: {e}")
|
| 52 |
return {"error": str(e)}
|
| 53 |
|
|
|
|
| 54 |
# Define the Gradio interface
|
| 55 |
iface = gr.Interface(
|
| 56 |
fn=predict_pptx_content,
|
|
|
|
| 33 |
|
| 34 |
predicted_label = result[0]['label']
|
| 35 |
predicted_probability = result[0]['score']
|
| 36 |
+
summary = summarizer(extracted_text, max_length=1000, min_length=30, do_sample=False)[0]['summary_text']
|
| 37 |
|
| 38 |
return {
|
| 39 |
"predicted_label": predicted_label,
|
| 40 |
"evaluation": predicted_probability,
|
| 41 |
"summary": summary
|
| 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,
|