Spaces:
Sleeping
Sleeping
Nikhil fix
Browse files
app.py
CHANGED
|
@@ -97,7 +97,10 @@ print(f"DEBUG app.py: HF_TOKEN loaded = {bool(HF_TOKEN)}, length = {len(HF_TOKEN
|
|
| 97 |
# PIPELINE GENERATORS
|
| 98 |
# ─────────────────────────────────────────────
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
| 101 |
"""Voice mode: mic audio → transcript, answer, citations, audio."""
|
| 102 |
if audio_input is None:
|
| 103 |
yield "", "कृपया माइक्रोफोन बटन दबाकर अपना प्रश्न पूछें।", "", None
|
|
@@ -157,7 +160,7 @@ def run_voice_pipeline(audio_input):
|
|
| 157 |
yield "", f"⚠️ त्रुटि: {e}", "", None
|
| 158 |
|
| 159 |
|
| 160 |
-
def run_text_pipeline(text_input: str):
|
| 161 |
"""Text mode: typed question → answer, citations, audio."""
|
| 162 |
if not text_input or not text_input.strip():
|
| 163 |
yield text_input, "कृपया एक प्रश्न लिखें।", "", None
|
|
@@ -394,4 +397,4 @@ def build_ui():
|
|
| 394 |
|
| 395 |
if __name__ == "__main__":
|
| 396 |
demo = build_ui()
|
| 397 |
-
demo.queue().launch()
|
|
|
|
| 97 |
# PIPELINE GENERATORS
|
| 98 |
# ─────────────────────────────────────────────
|
| 99 |
|
| 100 |
+
from typing import Generator, Tuple, Optional, Any
|
| 101 |
+
import numpy as np
|
| 102 |
+
|
| 103 |
+
def run_voice_pipeline(audio_input: Optional[Tuple[int, np.ndarray]]) -> Generator[Tuple[str, str, str, Optional[Tuple[int, np.ndarray]]], None, None]:
|
| 104 |
"""Voice mode: mic audio → transcript, answer, citations, audio."""
|
| 105 |
if audio_input is None:
|
| 106 |
yield "", "कृपया माइक्रोफोन बटन दबाकर अपना प्रश्न पूछें।", "", None
|
|
|
|
| 160 |
yield "", f"⚠️ त्रुटि: {e}", "", None
|
| 161 |
|
| 162 |
|
| 163 |
+
def run_text_pipeline(text_input: str) -> Generator[Tuple[str, str, str, Optional[Tuple[int, np.ndarray]]], None, None]:
|
| 164 |
"""Text mode: typed question → answer, citations, audio."""
|
| 165 |
if not text_input or not text_input.strip():
|
| 166 |
yield text_input, "कृपया एक प्रश्न लिखें।", "", None
|
|
|
|
| 397 |
|
| 398 |
if __name__ == "__main__":
|
| 399 |
demo = build_ui()
|
| 400 |
+
demo.queue().launch(show_api=False)
|