amangoyal05 commited on
Commit
218580c
·
verified ·
1 Parent(s): cd56738

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +90 -16
app.py CHANGED
@@ -43,8 +43,6 @@ def translate_text(source_text, source_lang, target_lang, temperature, top_k, re
43
  return gen_translate(source_text, source_lang, target_lang, temperature, top_k, repetition_penalty, max_tokens)
44
 
45
  languages = ["English", "Hindi", "Bengali", "Tamil", "Telugu", "Kannada", "Panjabi"]
46
- # css_path = "static/style.css"
47
- # custom_css = open(css_path, encoding="utf-8").read() if os.path.isfile(css_path) else ""
48
 
49
  theme_lock_css = """
50
  .gradio-container .theme-toggle,
@@ -54,16 +52,97 @@ theme_lock_css = """
54
  .gradio-container [data-testid="theme-toggle"] {
55
  display: none !important;
56
  }
57
-
58
  :root { color-scheme: dark !important; }
59
-
60
  body, .gradio-container {
61
  background-color: #0a1628 !important;
62
  color: #e6eef8 !important;
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  """
65
 
66
- # combined_css = theme_lock_css
67
  locked_theme = gr.themes.Monochrome(primary_hue="blue", secondary_hue="slate", neutral_hue="slate").set(
68
  background_fill_primary="#0a1628",
69
  background_fill_secondary="#1f2937",
@@ -86,7 +165,6 @@ with gr.Blocks(
86
  document.documentElement.setAttribute('data-theme', 'dark');
87
  document.body.classList.add('dark');
88
  document.body.classList.remove('light');
89
-
90
  const observer = new MutationObserver(function(mutations) {{
91
  mutations.forEach(function(mutation) {{
92
  mutation.addedNodes.forEach(function(node) {{
@@ -105,18 +183,14 @@ with gr.Blocks(
105
  with gr.Row(elem_classes="main-header"):
106
  with gr.Column():
107
  gr.HTML(f"""
108
- <div style="display:flex;align-items:center;justify-content:space-between;width:100%;">
109
- <!-- left: logo + text on one line -->
110
- <div style="display:flex;align-items:center;">
111
  {LOGO_HTML}
112
- <h3 style="margin-left:8px;margin-top:0;margin-bottom:0;">Maruth Labs</h3>
 
 
 
113
  </div>
114
-
115
- <!-- center title -->
116
- <div class="main-title"><h1>Madhuram Translation Model</h1></div>
117
-
118
- <!-- spacer to balance flex -->
119
- <div style="width:120px;"></div>
120
  </div>
121
  """)
122
 
 
43
  return gen_translate(source_text, source_lang, target_lang, temperature, top_k, repetition_penalty, max_tokens)
44
 
45
  languages = ["English", "Hindi", "Bengali", "Tamil", "Telugu", "Kannada", "Panjabi"]
 
 
46
 
47
  theme_lock_css = """
48
  .gradio-container .theme-toggle,
 
52
  .gradio-container [data-testid="theme-toggle"] {
53
  display: none !important;
54
  }
 
55
  :root { color-scheme: dark !important; }
 
56
  body, .gradio-container {
57
  background-color: #0a1628 !important;
58
  color: #e6eef8 !important;
59
  }
60
+
61
+ /* Mobile-responsive header fixes */
62
+ .main-header {
63
+ padding: 10px 5px !important;
64
+ }
65
+
66
+ .header-container {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: space-between;
70
+ width: 100%;
71
+ flex-wrap: wrap;
72
+ gap: 10px;
73
+ }
74
+
75
+ .logo-section {
76
+ display: flex;
77
+ align-items: center;
78
+ flex-shrink: 0;
79
+ min-width: 0;
80
+ }
81
+
82
+ .logo-section h3 {
83
+ margin-left: 8px;
84
+ margin-top: 0;
85
+ margin-bottom: 0;
86
+ white-space: nowrap;
87
+ font-size: 1rem;
88
+ }
89
+
90
+ .main-title {
91
+ flex: 1;
92
+ text-align: center;
93
+ min-width: 0;
94
+ }
95
+
96
+ .main-title h1 {
97
+ margin: 0;
98
+ font-size: 1.5rem;
99
+ line-height: 1.2;
100
+ word-break: break-word;
101
+ }
102
+
103
+ /* Mobile responsiveness */
104
+ @media (max-width: 768px) {
105
+ .header-container {
106
+ flex-direction: column;
107
+ align-items: center;
108
+ text-align: center;
109
+ gap: 15px;
110
+ }
111
+
112
+ .logo-section {
113
+ order: 1;
114
+ }
115
+
116
+ .main-title {
117
+ order: 2;
118
+ width: 100%;
119
+ }
120
+
121
+ .main-title h1 {
122
+ font-size: 1.3rem;
123
+ margin: 0;
124
+ }
125
+
126
+ .logo-section h3 {
127
+ font-size: 0.9rem;
128
+ }
129
+ }
130
+
131
+ @media (max-width: 480px) {
132
+ .main-title h1 {
133
+ font-size: 1.1rem;
134
+ }
135
+
136
+ .logo-section h3 {
137
+ font-size: 0.8rem;
138
+ }
139
+
140
+ .main-header {
141
+ padding: 8px 3px !important;
142
+ }
143
+ }
144
  """
145
 
 
146
  locked_theme = gr.themes.Monochrome(primary_hue="blue", secondary_hue="slate", neutral_hue="slate").set(
147
  background_fill_primary="#0a1628",
148
  background_fill_secondary="#1f2937",
 
165
  document.documentElement.setAttribute('data-theme', 'dark');
166
  document.body.classList.add('dark');
167
  document.body.classList.remove('light');
 
168
  const observer = new MutationObserver(function(mutations) {{
169
  mutations.forEach(function(mutation) {{
170
  mutation.addedNodes.forEach(function(node) {{
 
183
  with gr.Row(elem_classes="main-header"):
184
  with gr.Column():
185
  gr.HTML(f"""
186
+ <div class="header-container">
187
+ <div class="logo-section">
 
188
  {LOGO_HTML}
189
+ <h3>Maruth Labs</h3>
190
+ </div>
191
+ <div class="main-title">
192
+ <h1>Madhuram Translation Model</h1>
193
  </div>
 
 
 
 
 
 
194
  </div>
195
  """)
196