sanzanalora commited on
Commit
9a1360d
·
verified ·
1 Parent(s): 6cd5148

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -34
app.py CHANGED
@@ -45,30 +45,30 @@ def process_text(text, task):
45
  }
46
  return task_funcs.get(task, lambda x: "Invalid Task")(text)
47
 
48
- # Task-specific examples with clear labels
49
  examples = [
50
- ("Translate English to Bengali", [
51
  ["The sky is blue, and the weather is nice."],
52
  ["Artificial intelligence is shaping the future."],
53
  ["Bangladesh is known for its rich culture and heritage."]
54
- ]),
55
- ("Translate Bengali to English", [
56
  ["বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।"],
57
  ["ঢাকা বাংলাদেশের রাজধানী।"],
58
  ["রবীন্দ্রনাথ ঠাকুরের গান বাংলা সংস্কৃতির একটি অবিচ্ছেদ্য অংশ।"]
59
- ]),
60
- ("Summarize", [
61
  ["The Department of Computer Science and Engineering, established in 1982, was the first of its kind in Bangladesh. "
62
  "Attracting top students from all over the country, it offers both undergraduate and postgraduate degrees."],
63
  ["Climate change is one of the biggest challenges we face today. With rising temperatures and unpredictable weather, "
64
  "the world needs to come together to find sustainable solutions."],
65
  ["Technology has advanced rapidly over the past decade, with innovations in fields like AI, robotics, and quantum computing."]
66
- ]),
67
- ("Paraphrase", [
68
  ["The cat is sitting on the mat."],
69
  ["He was very happy to receive the award."],
70
  ["The weather today is sunny and warm."]
71
- ])
72
  ]
73
 
74
  # Enhanced visual layout and interface design
@@ -87,32 +87,29 @@ iface = gr.Interface(
87
  title="BanglaT5 Model Hub - Translation, Summarization & Paraphrasing",
88
  description="Explore the power of BanglaT5 with this easy-to-use interface for multiple tasks like translation, summarization, and paraphrasing.",
89
  theme="huggingface/space-shuttle",
90
- examples=[
91
- ("Translate English to Bengali", [
92
- ["The sky is blue, and the weather is nice."],
93
- ["Artificial intelligence is shaping the future."],
94
- ["Bangladesh is known for its rich culture and heritage."]
95
- ]),
96
- ("Translate Bengali to English", [
97
- ["বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।"],
98
- ["ঢাকা বাংলাদেশের রাজধানী।"],
99
- ["রবীন্দ্রনাথ ঠাকুরের গান বাংলা সংস্কৃতির একটি অবিচ্ছেদ্য অংশ।"]
100
- ]),
101
- ("Summarize", [
102
- ["The Department of Computer Science and Engineering, established in 1982, was the first of its kind in Bangladesh. "
103
- "Attracting top students from all over the country, it offers both undergraduate and postgraduate degrees."],
104
- ["Climate change is one of the biggest challenges we face today. With rising temperatures and unpredictable weather, "
105
- "the world needs to come together to find sustainable solutions."],
106
- ["Technology has advanced rapidly over the past decade, with innovations in fields like AI, robotics, and quantum computing."]
107
- ]),
108
- ("Paraphrase", [
109
- ["The cat is sitting on the mat."],
110
- ["He was very happy to receive the award."],
111
- ["The weather today is sunny and warm."]
112
- ])
113
- ],
114
  allow_flagging="auto",
115
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  )
117
 
118
  # Launch the Gradio app
 
45
  }
46
  return task_funcs.get(task, lambda x: "Invalid Task")(text)
47
 
48
+ # Task-specific examples with clear labels for each task
49
  examples = [
50
+ ["Translate English to Bengali", [
51
  ["The sky is blue, and the weather is nice."],
52
  ["Artificial intelligence is shaping the future."],
53
  ["Bangladesh is known for its rich culture and heritage."]
54
+ ]],
55
+ ["Translate Bengali to English", [
56
  ["বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।"],
57
  ["ঢাকা বাংলাদেশের রাজধানী।"],
58
  ["রবীন্দ্রনাথ ঠাকুরের গান বাংলা সংস্কৃতির একটি অবিচ্ছেদ্য অংশ।"]
59
+ ]],
60
+ ["Summarize", [
61
  ["The Department of Computer Science and Engineering, established in 1982, was the first of its kind in Bangladesh. "
62
  "Attracting top students from all over the country, it offers both undergraduate and postgraduate degrees."],
63
  ["Climate change is one of the biggest challenges we face today. With rising temperatures and unpredictable weather, "
64
  "the world needs to come together to find sustainable solutions."],
65
  ["Technology has advanced rapidly over the past decade, with innovations in fields like AI, robotics, and quantum computing."]
66
+ ]],
67
+ ["Paraphrase", [
68
  ["The cat is sitting on the mat."],
69
  ["He was very happy to receive the award."],
70
  ["The weather today is sunny and warm."]
71
+ ]]
72
  ]
73
 
74
  # Enhanced visual layout and interface design
 
87
  title="BanglaT5 Model Hub - Translation, Summarization & Paraphrasing",
88
  description="Explore the power of BanglaT5 with this easy-to-use interface for multiple tasks like translation, summarization, and paraphrasing.",
89
  theme="huggingface/space-shuttle",
90
+ examples=examples, # Show examples as per tasks with 3 for each
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  allow_flagging="auto",
92
+ layout="horizontal", # Adding a horizontal layout for a cleaner design
93
+ css="""
94
+ #dropdown-task {
95
+ color: #2C3E50;
96
+ font-size: 18px;
97
+ }
98
+ .output-area {
99
+ color: #2C3E50;
100
+ }
101
+ .examples {
102
+ display: grid;
103
+ grid-template-columns: 1fr 1fr;
104
+ gap: 20px;
105
+ }
106
+ .output-text {
107
+ background-color: #E8F6F3;
108
+ }
109
+ .gr-textbox {
110
+ border-radius: 10px;
111
+ }
112
+ """
113
  )
114
 
115
  # Launch the Gradio app