Junaed59 commited on
Commit
2ce6cc9
·
verified ·
1 Parent(s): a359bc7

Update app.py

Browse files

![1000003774.png](https://cdn-uploads.huggingface.co/production/uploads/6866711c4357f5b535fb9015/1wHfjdB1Lx4UrX00UP9C7.png)

Files changed (1) hide show
  1. app.py +2 -17
app.py CHANGED
@@ -1,25 +1,10 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load Bengali AI model
5
  bangla_ai = pipeline("text2text-generation", model="csebuetnlp/banglat5")
6
 
7
- # Custom Q&A pairs (edit these!)
8
- qa_pairs = {
9
- "মুক্তিযুদ্ধ কবে শুরু হয়েছিল?": "১৯৭১ সালের ২৬ মার্চ।",
10
- "When did the Liberation War begin?": "March 26, 1971."
11
- }
12
-
13
  def chat(message):
14
- # Check if question is in Q&A pairs
15
- if message in qa_pairs:
16
- return qa_pairs[message]
17
- # Else, use BanglaT5
18
  return bangla_ai(message, max_length=100)[0]['generated_text']
19
 
20
- # Create interface
21
- with gr.Blocks(theme=gr.themes.Soft()) as app:
22
- gr.Image("1000003774.png", width=200, label="NOTUNBANGLA") # Your logo
23
- gr.ChatInterface(chat, title="NOTUNBANGLA AI", description="বাংলায় প্রশ্ন করুন")
24
-
25
- app.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load model
5
  bangla_ai = pipeline("text2text-generation", model="csebuetnlp/banglat5")
6
 
 
 
 
 
 
 
7
  def chat(message):
 
 
 
 
8
  return bangla_ai(message, max_length=100)[0]['generated_text']
9
 
10
+ gr.ChatInterface(chat, title="NOTUNBANGLA AI").launch()