hailetass12 commited on
Commit
5e49c9f
Β·
verified Β·
1 Parent(s): ec6165c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -40,31 +40,33 @@ torch.set_num_interop_threads(1)
40
  logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
41
  logger = logging.getLogger("ethio_asr")
42
 
 
 
 
43
  def get_logo_html():
44
- """Return logo HTML using robust base64 embedding (HF Spaces safe)."""
45
 
46
  try:
47
- # Resolve absolute path relative to this script
48
  logo_path = Path(__file__).parent / "logo.png"
49
 
50
  if not logo_path.exists():
51
  print(f"[Logo] File not found: {logo_path}")
52
- return "" # fail gracefully
53
 
54
- # Read and encode image
55
  with open(logo_path, "rb") as f:
56
  encoded = base64.b64encode(f.read()).decode("utf-8")
57
 
58
  return f"""
59
- <div style="text-align: center; margin-bottom: 10px;">
60
  <img src="data:image/png;base64,{encoded}"
61
  alt="Ethio CropAI Logo"
62
  style="
63
- max-width: 110px;
64
- height: auto;
 
65
  border-radius: 50%;
66
- border: 3px solid #166534;
67
- box-shadow: 0 4px 8px rgba(0,0,0,0.2);
68
  ">
69
  </div>
70
  """
@@ -72,6 +74,7 @@ def get_logo_html():
72
  except Exception as e:
73
  print(f"[Logo Error] {e}")
74
  return ""
 
75
  # ─────────────────────────────────────────────────────────────
76
  # πŸ€– MODEL LOAD (Singleton)
77
  # ─────────────────────────────────────────────────────────────
@@ -244,9 +247,9 @@ with gr.Blocks(title="Ethio CropAI ASR", analytics_enabled=False) as demo:
244
  logo_html = get_logo_html()
245
  gr.HTML(logo_html)
246
 
247
- gr.Markdown("# πŸ‡ͺπŸ‡Ή Ethio-ASR: Multilingual Speech-to-Text")
248
  gr.Markdown(
249
- "**Research Project**: AI Voice Interface for Ethiopian Farmers by Ethio CropAI.\n"
250
  "Supported: `Amharic` | `Afaan Oromo` | `Tigrinya` | `Sidaama` | `Wolaytta`"
251
  )
252
 
 
40
  logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
41
  logger = logging.getLogger("ethio_asr")
42
 
43
+ import base64
44
+ from pathlib import Path
45
+
46
  def get_logo_html():
47
+ """Return centered, slightly larger logo."""
48
 
49
  try:
 
50
  logo_path = Path(__file__).parent / "logo.png"
51
 
52
  if not logo_path.exists():
53
  print(f"[Logo] File not found: {logo_path}")
54
+ return ""
55
 
 
56
  with open(logo_path, "rb") as f:
57
  encoded = base64.b64encode(f.read()).decode("utf-8")
58
 
59
  return f"""
60
+ <div style="display: flex; justify-content: center; align-items: center; margin-bottom: 15px;">
61
  <img src="data:image/png;base64,{encoded}"
62
  alt="Ethio CropAI Logo"
63
  style="
64
+ width: 140px;
65
+ height: 140px;
66
+ object-fit: cover;
67
  border-radius: 50%;
68
+ border: 4px solid #166534;
69
+ box-shadow: 0 6px 12px rgba(0,0,0,0.25);
70
  ">
71
  </div>
72
  """
 
74
  except Exception as e:
75
  print(f"[Logo Error] {e}")
76
  return ""
77
+
78
  # ─────────────────────────────────────────────────────────────
79
  # πŸ€– MODEL LOAD (Singleton)
80
  # ─────────────────────────────────────────────────────────────
 
247
  logo_html = get_logo_html()
248
  gr.HTML(logo_html)
249
 
250
+ gr.Markdown("# Ethio CropAI-ASR: Multilingual Speech-to-Text")
251
  gr.Markdown(
252
+ " AI Voice Interface for Ethiopian Farmers by Ethio CropAI.\n"
253
  "Supported: `Amharic` | `Afaan Oromo` | `Tigrinya` | `Sidaama` | `Wolaytta`"
254
  )
255