PJ2005 commited on
Commit
8c0ca13
·
verified ·
1 Parent(s): b0cf398

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -1,8 +1,21 @@
1
  import gradio as gr
2
- from ai_powered_emoji_recommender import recommend_emojis # your function
3
 
4
- def predict(text):
5
- return recommend_emojis(text)
6
 
7
- iface = gr.Interface(fn=predict, inputs="text", outputs="text", title="AI Emoji Recommender")
8
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load summarizer pipeline (T5 model, lightweight)
5
+ summarizer = pipeline("summarization", model="t5-small")
6
 
7
+ def summarize_text(text):
8
+ summary = summarizer(text, max_length=150, min_length=30, do_sample=False)
9
+ return summary[0]['summary_text']
10
+
11
+ # Gradio interface
12
+ iface = gr.Interface(
13
+ fn=summarize_text,
14
+ inputs=gr.Textbox(lines=8, placeholder="Paste any article or text here..."),
15
+ outputs=gr.Textbox(lines=8), # show full text without scrolling
16
+ title="AI Text Summarizer 📖✨",
17
+ description="Paste long text and get concise, clear summaries instantly!"
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ iface.launch()