Raahulthakur commited on
Commit
9053ece
Β·
verified Β·
1 Parent(s): 73ff4b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -20
app.py CHANGED
@@ -1,11 +1,8 @@
1
- # app.py
2
-
3
  import gradio as gr
4
  from modules.summarizer import summarize_text
5
  from modules.classifier import classify_text
6
  from modules.event_detector import detect_events
7
 
8
- # Define individual task functions
9
  def process_summarization(input_text):
10
  summary = summarize_text(input_text)
11
  return summary
@@ -19,27 +16,25 @@ def process_event_detection(input_text):
19
  events_formatted = ', '.join(events) if isinstance(events, list) else events
20
  return events_formatted
21
 
22
- # Create Gradio UI with Tabs
23
  with gr.Blocks() as demo:
24
  gr.Markdown(
25
  """
26
- # 🧠 NLP Assistant
27
  A simple app for:
28
- - πŸ“š Summarization
29
- - 🏷️ News Classification
30
- - πŸ—‚οΈ Event Detection
31
  """
32
  )
33
 
34
  with gr.Tabs():
35
- # Summarization Tab
36
- with gr.Tab("πŸ“š Summarization"):
37
  gr.Markdown(
38
  """
39
- ## πŸ“š Summarization
40
  Enter your text below and get a summarized version.
41
 
42
- ⚠️ **Note:**
43
  - This task can take **~800–1000 seconds (~13–16 minutes)** for about **700–800 words**.
44
  - Longer articles will take **even more time**.
45
  - Please be patient!
@@ -59,11 +54,10 @@ with gr.Blocks() as demo:
59
  outputs=[summary_output]
60
  )
61
 
62
- # Classification Tab
63
- with gr.Tab("🏷️ Classification"):
64
  gr.Markdown(
65
  """
66
- ## 🏷️ News/Text Classification
67
  Enter your text below to detect its category.
68
  """
69
  )
@@ -81,11 +75,10 @@ with gr.Blocks() as demo:
81
  outputs=[classification_output]
82
  )
83
 
84
- # Event Detection Tab
85
- with gr.Tab("πŸ—‚οΈ Event Detection"):
86
  gr.Markdown(
87
  """
88
- ## πŸ—‚οΈ Event Detection
89
  Extract keywords and named entities from your text.
90
  """
91
  )
@@ -103,6 +96,5 @@ with gr.Blocks() as demo:
103
  outputs=[events_output]
104
  )
105
 
106
- # Launch Gradio app
107
  if __name__ == "__main__":
108
- demo.launch()
 
 
 
1
  import gradio as gr
2
  from modules.summarizer import summarize_text
3
  from modules.classifier import classify_text
4
  from modules.event_detector import detect_events
5
 
 
6
  def process_summarization(input_text):
7
  summary = summarize_text(input_text)
8
  return summary
 
16
  events_formatted = ', '.join(events) if isinstance(events, list) else events
17
  return events_formatted
18
 
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown(
21
  """
22
+ # NLP Assistant
23
  A simple app for:
24
+ - Summarization
25
+ - News Classification
26
+ - Event Detection
27
  """
28
  )
29
 
30
  with gr.Tabs():
31
+ with gr.Tab("Summarization"):
 
32
  gr.Markdown(
33
  """
34
+ ## Summarization
35
  Enter your text below and get a summarized version.
36
 
37
+ **Note:**
38
  - This task can take **~800–1000 seconds (~13–16 minutes)** for about **700–800 words**.
39
  - Longer articles will take **even more time**.
40
  - Please be patient!
 
54
  outputs=[summary_output]
55
  )
56
 
57
+ with gr.Tab("Classification"):
 
58
  gr.Markdown(
59
  """
60
+ ## News/Text Classification
61
  Enter your text below to detect its category.
62
  """
63
  )
 
75
  outputs=[classification_output]
76
  )
77
 
78
+ with gr.Tab("Event Detection"):
 
79
  gr.Markdown(
80
  """
81
+ ## Event Detection
82
  Extract keywords and named entities from your text.
83
  """
84
  )
 
96
  outputs=[events_output]
97
  )
98
 
 
99
  if __name__ == "__main__":
100
+ demo.launch()