Spaces:
Runtime error
Runtime error
Download app.py from Ayush027/async-rust-rag: direct link, hf CLI and curl.
- Browser
- Download file 985 Bytes
-
https://huggingface.co/spaces/Ayush027/async-rust-rag/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ayush027/async-rust-rag/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ayush027/async-rust-rag/resolve/main/app.py
985 Bytes
| import gradio as gr | |
| from src.query import query | |
| def chat_fn(message, history): | |
| answer, sources, _ = query(message) | |
| unique_sources = list(dict.fromkeys(sources)) # dedupe, keep order | |
| sources_text = "\n".join(f"- `{s}`" for s in unique_sources) | |
| return f"{answer}\n\n**Sources:**\n{sources_text}" | |
| demo = gr.ChatInterface( | |
| fn=chat_fn, | |
| title="🦀 Async Rust Debugging Assistant", | |
| description=( | |
| "Ask about debugging async Rust : deadlocks, stuck futures, " | |
| "tokio task scheduling, and tracing instrumentation. " | |
| "Answers are grounded in the tokio docs, tracing crate, and Rust async book." | |
| ), | |
| examples=[ | |
| "How do I debug a deadlock in tokio?", | |
| "What is the difference between spawn and spawn_blocking?", | |
| "How does the tracing crate work with async functions?", | |
| "Why does my tokio::spawn silently die when I drop the JoinHandle?", | |
| ], | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |