rioanggara commited on
Commit
801be53
·
1 Parent(s): ab753b8
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -32,15 +32,18 @@ def text_summarization(text):
32
  summary = summarizer(text, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
33
  return summary
34
 
35
- # Define your interface with two output components
36
- interface = gr.Interface(
37
- fn=[text_analysis, text_summarization],
38
- inputs=gr.Textbox(lines=4, placeholder="Type something here..."),
39
- outputs=[gr.JSON(label="Text Analysis"), "text"],
40
- title="Comprehensive Text Analysis with Language Detection and Summarization",
41
- description="This app provides detailed analysis including language detection, sentence, word, and character counts, lists the most common and unique words, calculates readability, and provides a concise summary of the text."
42
- )
 
 
 
43
 
44
  # Launch the app
45
  if __name__ == "__main__":
46
- interface.launch()
 
32
  summary = summarizer(text, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
33
  return summary
34
 
35
+ # Define interfaces for each function
36
+ text_analysis_interface = gr.Interface(fn=text_analysis,
37
+ inputs=gr.Textbox(lines=4, placeholder="Type something here..."),
38
+ outputs=gr.JSON(label="Text Analysis"))
39
+
40
+ text_summarization_interface = gr.Interface(fn=text_summarization,
41
+ inputs=gr.Textbox(lines=4, placeholder="Type something here..."),
42
+ outputs="text")
43
+
44
+ # Combine interfaces using gr.Parallel
45
+ iface = gr.Parallel(text_analysis_interface, text_summarization_interface)
46
 
47
  # Launch the app
48
  if __name__ == "__main__":
49
+ iface.launch()