Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def predict_pptx_content(file_path):
|
|
20 |
cleaned_text = re.sub(r'\s+', ' ', extracted_text)
|
21 |
|
22 |
classifier = pipeline("text-classification", model="Ahmed235/roberta_classification")
|
23 |
-
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
24 |
|
25 |
result = classifier(cleaned_text)[0]
|
26 |
predicted_label = result['label']
|
@@ -28,8 +28,8 @@ def predict_pptx_content(file_path):
|
|
28 |
|
29 |
prediction = {
|
30 |
"Predicted Label": predicted_label,
|
31 |
-
"Evaluation": f"Evaluate the topic according to {predicted_label} is: {predicted_probability}"
|
32 |
-
"Summary": summarizer(cleaned_text, max_length=80, min_length=30, do_sample=False)
|
33 |
}
|
34 |
|
35 |
return prediction
|
@@ -38,7 +38,7 @@ def predict_pptx_content(file_path):
|
|
38 |
iface = gr.Interface(
|
39 |
fn=predict_pptx_content,
|
40 |
inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
|
41 |
-
outputs=["text", "text"
|
42 |
live=False, # Change to False for one-time analysis
|
43 |
title="<h1 style='color: lightgreen; text-align: center;'>PPTX Analyzer</h1>",
|
44 |
)
|
|
|
20 |
cleaned_text = re.sub(r'\s+', ' ', extracted_text)
|
21 |
|
22 |
classifier = pipeline("text-classification", model="Ahmed235/roberta_classification")
|
23 |
+
#summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
24 |
|
25 |
result = classifier(cleaned_text)[0]
|
26 |
predicted_label = result['label']
|
|
|
28 |
|
29 |
prediction = {
|
30 |
"Predicted Label": predicted_label,
|
31 |
+
"Evaluation": f"Evaluate the topic according to {predicted_label} is: {predicted_probability}"
|
32 |
+
#"Summary": summarizer(cleaned_text, max_length=80, min_length=30, do_sample=False)
|
33 |
}
|
34 |
|
35 |
return prediction
|
|
|
38 |
iface = gr.Interface(
|
39 |
fn=predict_pptx_content,
|
40 |
inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
|
41 |
+
outputs=["text", "text"], # Predicted Label, Evaluation, Summary
|
42 |
live=False, # Change to False for one-time analysis
|
43 |
title="<h1 style='color: lightgreen; text-align: center;'>PPTX Analyzer</h1>",
|
44 |
)
|