ankitklakra commited on
Commit
0a2805f
ยท
verified ยท
1 Parent(s): 45b101e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -94,7 +94,6 @@ def process_translation(text, audio_input, direction, is_hinglish):
94
  return original_text, translated_text, audio_output
95
 
96
  # --- CUSTOM CSS ---
97
-
98
  custom_css = """
99
  <style>
100
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
@@ -102,20 +101,16 @@ body, button, input, select, textarea, .gradio-container { font-family: 'Poppins
102
  .header-div { text-align: center; margin-bottom: 20px; }
103
  .header-title { font-size: 2.5em; font-weight: 600; color: #2c3e50; margin: 0; }
104
  .header-subtitle { font-size: 1.2em; color: #7f8c8d; font-weight: 300; margin-top: 5px; }
105
- .input-box, .output-box { border: 1px solid #e0e0e0; border-radius: 12px; padding: 20px; background: white; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
106
- .primary-btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: white !important; font-weight: bold; border-radius: 8px; }
107
- .feedback-area { background-color: #f9f9f9; border-left: 5px solid #f1c40f; padding: 15px; border-radius: 5px; }
108
  </style>
109
  """
110
 
111
  # --- THE UI ---
112
-
113
  with gr.Blocks(title="Kurukh AI Translator") as demo:
114
 
115
- # INJECT CSS MANUALLY
116
  gr.HTML(custom_css)
117
 
118
- # HEADER (Using HTML for better styling control)
119
  gr.HTML("""
120
  <div class="header-div">
121
  <h1 class="header-title">๐Ÿ‡ฎ๐Ÿ‡ณ AI Kurukh (Oraon) Translator</h1>
@@ -146,16 +141,18 @@ with gr.Blocks(title="Kurukh AI Translator") as demo:
146
  is_hinglish = gr.Checkbox(label="๐Ÿ”ค Hinglish Typing (e.g. 'Tumhara')", value=False)
147
 
148
  input_text = gr.Textbox(label="Enter Text", placeholder="Type sentences here...", lines=4)
149
- input_audio = gr.Audio(sources=["microphone"], type="filepath", label="๐ŸŽ™๏ธ Voice Input (Hindi Only)")
150
 
151
-
 
 
152
  translate_btn = gr.Button("Translate ๐Ÿš€", variant="primary")
153
 
154
  # RIGHT COLUMN
155
  with gr.Column():
156
  gr.Markdown("### ๐Ÿ“ค Translation Result")
157
- output_text = gr.Textbox(label="Translation", lines=4, interactive=False, show_copy_button=True)
158
- output_audio = gr.Audio(label="๐Ÿ”Š Listen (Hindi Only)", interactive=False, autoplay=False)
 
159
 
160
  translate_btn.click(
161
  fn=process_translation,
@@ -169,7 +166,7 @@ with gr.Blocks(title="Kurukh AI Translator") as demo:
169
  gr.Markdown("Our AI is learning! If you spot a mistake, please submit the correct translation below.")
170
 
171
 
172
- with gr.Group():
173
  with gr.Row():
174
  fb_direction = gr.Radio(["Kurukh -> Hindi", "Hindi -> Kurukh"], label="Direction", value="Kurukh -> Hindi")
175
 
 
94
  return original_text, translated_text, audio_output
95
 
96
  # --- CUSTOM CSS ---
 
97
  custom_css = """
98
  <style>
99
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
 
101
  .header-div { text-align: center; margin-bottom: 20px; }
102
  .header-title { font-size: 2.5em; font-weight: 600; color: #2c3e50; margin: 0; }
103
  .header-subtitle { font-size: 1.2em; color: #7f8c8d; font-weight: 300; margin-top: 5px; }
 
 
 
104
  </style>
105
  """
106
 
107
  # --- THE UI ---
 
108
  with gr.Blocks(title="Kurukh AI Translator") as demo:
109
 
110
+ # INJECT CSS MANUALLY
111
  gr.HTML(custom_css)
112
 
113
+ # HEADER
114
  gr.HTML("""
115
  <div class="header-div">
116
  <h1 class="header-title">๐Ÿ‡ฎ๐Ÿ‡ณ AI Kurukh (Oraon) Translator</h1>
 
141
  is_hinglish = gr.Checkbox(label="๐Ÿ”ค Hinglish Typing (e.g. 'Tumhara')", value=False)
142
 
143
  input_text = gr.Textbox(label="Enter Text", placeholder="Type sentences here...", lines=4)
 
144
 
145
+
146
+ input_audio = gr.Audio(source="microphone", type="filepath", label="๐ŸŽ™๏ธ Voice Input (Hindi Only)")
147
+
148
  translate_btn = gr.Button("Translate ๐Ÿš€", variant="primary")
149
 
150
  # RIGHT COLUMN
151
  with gr.Column():
152
  gr.Markdown("### ๐Ÿ“ค Translation Result")
153
+
154
+ output_text = gr.Textbox(label="Translation", lines=4, interactive=False)
155
+ output_audio = gr.Audio(label="๐Ÿ”Š Listen (Hindi Only)", interactive=False)
156
 
157
  translate_btn.click(
158
  fn=process_translation,
 
166
  gr.Markdown("Our AI is learning! If you spot a mistake, please submit the correct translation below.")
167
 
168
 
169
+ with gr.Column():
170
  with gr.Row():
171
  fb_direction = gr.Radio(["Kurukh -> Hindi", "Hindi -> Kurukh"], label="Direction", value="Kurukh -> Hindi")
172