Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
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 |
-
|
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()
|
|
|
|
|
|
|
|
|
|