Spaces:
Runtime error
Runtime error
Download app.py from KeyarSrini/graph-rag-vs-llmax: direct link, hf CLI and curl.
- Browser
- Download file 467 Bytes
-
https://huggingface.co/spaces/KeyarSrini/graph-rag-vs-llmax/resolve/main/app.py
- Command line
-
hf download hf://spaces/KeyarSrini/graph-rag-vs-llmax/app.py
-
curl -L -o app.py https://huggingface.co/spaces/KeyarSrini/graph-rag-vs-llmax/resolve/main/app.py
467 Bytes
| import gradio as gr | |
| from llama_index import SimpleDirectoryReader, GPTVectorStoreIndex | |
| # Load documents (assumes /data contains rajini.txt) | |
| documents = SimpleDirectoryReader('./data').load_data() | |
| index = GPTVectorStoreIndex.from_documents(documents) | |
| query_engine = index.as_query_engine() | |
| def answer_query(query): | |
| response = query_engine.query(query) | |
| return str(response) | |
| iface = gr.Interface(fn=answer_query, inputs="text", outputs="text") | |
| iface.launch() | |