Update app.py
Browse files
app.py
CHANGED
@@ -26,10 +26,10 @@ def predict_pptx_content(file_path):
|
|
26 |
extracted_text = extract_text_from_pptx(file_path)
|
27 |
cleaned_text = re.sub(r'\s+', ' ', extracted_text)
|
28 |
|
29 |
-
|
30 |
limited_text = limit_text_length(cleaned_text)
|
31 |
|
32 |
-
|
33 |
result = classifier(limited_text)
|
34 |
|
35 |
predicted_label = result[0]['label']
|
@@ -44,14 +44,14 @@ def predict_pptx_content(file_path):
|
|
44 |
|
45 |
output_dict = json.dumps(output, indent = 3)
|
46 |
|
47 |
-
return {"output": output_dict}
|
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 |
-
|
55 |
iface = gr.Interface(
|
56 |
fn=predict_pptx_content,
|
57 |
inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
|
|
|
26 |
extracted_text = extract_text_from_pptx(file_path)
|
27 |
cleaned_text = re.sub(r'\s+', ' ', extracted_text)
|
28 |
|
29 |
+
|
30 |
limited_text = limit_text_length(cleaned_text)
|
31 |
|
32 |
+
|
33 |
result = classifier(limited_text)
|
34 |
|
35 |
predicted_label = result[0]['label']
|
|
|
44 |
|
45 |
output_dict = json.dumps(output, indent = 3)
|
46 |
|
47 |
+
return {"output": output_dict}
|
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 |
+
|
55 |
iface = gr.Interface(
|
56 |
fn=predict_pptx_content,
|
57 |
inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
|