utkarshshukla2912 commited on
Commit
91549c5
·
1 Parent(s): 9d4ad1c

added ringg_ai

Browse files
Files changed (1) hide show
  1. app.py +33 -5
app.py CHANGED
@@ -5,12 +5,20 @@ Makes API calls to private inference endpoint via ngrok
5
  """
6
 
7
  import os
8
- import numpy as np
 
 
9
  import gradio as gr
10
  import requests
11
- import base64
12
- import io
13
- from typing import Optional
 
 
 
 
 
 
14
 
15
  # Custom CSS for Ringg branding
16
  custom_css = """
@@ -31,7 +39,20 @@ custom_css = """
31
  }
32
  .main-header .main-logo {
33
  height: 60px;
 
34
  flex-shrink: 0;
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
  .main-header .main-text {
37
  text-align: left;
@@ -199,13 +220,20 @@ def create_interface():
199
  title="Ringg STT V0", theme=gr.themes.Soft(), css=custom_css
200
  ) as demo:
201
  status_class = "healthy" if health_status["status"] == "healthy" else "error"
 
 
 
 
 
 
202
  gr.Markdown(f"""
203
  <div class="main-header">
204
- <img src="file=logo.png" alt="Ringg Logo" class="main-logo" style="height: 60px;">
205
  <div class="main-text">
206
  <h1>Ringg STT V0</h1>
207
  <p>High-Accuracy Hindi Speech-to-Text <span class="status-dot {status_class}"></span></p>
208
  </div>
 
209
  """)
210
 
211
  gr.Markdown(
 
5
  """
6
 
7
  import os
8
+ import base64
9
+ from pathlib import Path
10
+
11
  import gradio as gr
12
  import requests
13
+
14
+
15
+ LOGO_BASE64 = ""
16
+ logo_path = Path(__file__).parent / "logo.png"
17
+ if logo_path.exists():
18
+ try:
19
+ LOGO_BASE64 = base64.b64encode(logo_path.read_bytes()).decode("utf-8")
20
+ except Exception as e:
21
+ print(f"⚠️ Unable to load logo.png: {e}")
22
 
23
  # Custom CSS for Ringg branding
24
  custom_css = """
 
39
  }
40
  .main-header .main-logo {
41
  height: 60px;
42
+ width: 60px;
43
  flex-shrink: 0;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ }
48
+ .main-header .main-logo img {
49
+ max-height: 100%;
50
+ max-width: 100%;
51
+ object-fit: contain;
52
+ }
53
+ .main-header .main-logo.main-logo--placeholder {
54
+ background-color: rgba(255, 255, 255, 0.2);
55
+ border-radius: 12px;
56
  }
57
  .main-header .main-text {
58
  text-align: left;
 
220
  title="Ringg STT V0", theme=gr.themes.Soft(), css=custom_css
221
  ) as demo:
222
  status_class = "healthy" if health_status["status"] == "healthy" else "error"
223
+ logo_html = (
224
+ f'<div class="main-logo"><img src="data:image/png;base64,{LOGO_BASE64}" alt="Ringg Logo"></div>'
225
+ if LOGO_BASE64
226
+ else '<div class="main-logo main-logo--placeholder"></div>'
227
+ )
228
+
229
  gr.Markdown(f"""
230
  <div class="main-header">
231
+ {logo_html}
232
  <div class="main-text">
233
  <h1>Ringg STT V0</h1>
234
  <p>High-Accuracy Hindi Speech-to-Text <span class="status-dot {status_class}"></span></p>
235
  </div>
236
+ </div>
237
  """)
238
 
239
  gr.Markdown(