Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import html
|
|
| 9 |
import json
|
| 10 |
import os
|
| 11 |
import re
|
|
|
|
| 12 |
from collections import Counter, defaultdict
|
| 13 |
from dataclasses import asdict, dataclass
|
| 14 |
from pathlib import Path
|
|
@@ -426,6 +427,7 @@ def test_hf_token() -> str:
|
|
| 426 |
except Exception as exc:
|
| 427 |
return f"HF token/model test failed: `{type(exc).__name__}: {exc}`"
|
| 428 |
|
|
|
|
| 429 |
def ask_question(query: str, top_k: int = 5, answer_mode: str = "auto") -> Tuple[str, str]:
|
| 430 |
"""Ask a question against indexed documents. Public Gradio API endpoint: ask_question."""
|
| 431 |
query = (query or "").strip()
|
|
|
|
| 9 |
import json
|
| 10 |
import os
|
| 11 |
import re
|
| 12 |
+
import spaces
|
| 13 |
from collections import Counter, defaultdict
|
| 14 |
from dataclasses import asdict, dataclass
|
| 15 |
from pathlib import Path
|
|
|
|
| 427 |
except Exception as exc:
|
| 428 |
return f"HF token/model test failed: `{type(exc).__name__}: {exc}`"
|
| 429 |
|
| 430 |
+
@spaces.GPU
|
| 431 |
def ask_question(query: str, top_k: int = 5, answer_mode: str = "auto") -> Tuple[str, str]:
|
| 432 |
"""Ask a question against indexed documents. Public Gradio API endpoint: ask_question."""
|
| 433 |
query = (query or "").strip()
|