Ahmed235 commited on
Commit
d077b39
·
verified ·
1 Parent(s): 95aff45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -34,12 +34,13 @@ def predict_pptx_content(file_path):
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
- prediction = {
38
- "Predicted_Label": f"{predicted_label}",
39
- "Evaluation": f"Evaluate the topic according to {predicted_label} is: {predicted_probability}",
40
- "Summary": summary,
41
- }
42
 
 
 
 
 
 
 
43
 
44
  return prediction
45
 
@@ -52,7 +53,7 @@ def predict_pptx_content(file_path):
52
  iface = gr.Interface(
53
  fn=predict_pptx_content,
54
  inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
55
- outputs=["text"],
56
  live=False,
57
  title="<h1 style='color: lightgreen; text-align: center;'>HackTalk Analyzer</h1>",
58
  )
 
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 a dictionary with keys corresponding to Gradio output components
39
+ prediction = {
40
+ "text": f"Predicted Label: {predicted_label}",
41
+ "text_1": f"Evaluation: Evaluate the topic according to {predicted_label} is: {predicted_probability}",
42
+ "text_2": f"Summary: {summary}",
43
+ }
44
 
45
  return prediction
46
 
 
53
  iface = gr.Interface(
54
  fn=predict_pptx_content,
55
  inputs=gr.File(type="filepath", label="Upload PowerPoint (.pptx) file"),
56
+ outputs=["text", "text_1", "text_2"],
57
  live=False,
58
  title="<h1 style='color: lightgreen; text-align: center;'>HackTalk Analyzer</h1>",
59
  )