arxiv-rag-mvp / app.py
donb-hf's picture
add api changes
c29b3b9
raw
history blame contribute delete
908 Bytes
# File: app.py
import gradio as gr
from retrieval import rag_query
import logging
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def gradio_interface(query: str) -> str:
try:
logging.info(f"Received query: {query}")
result = rag_query(query)
logging.info("Query processed successfully")
return result
except Exception as e:
logging.error(f"Error processing query: {str(e)}")
return f"An error occurred: {str(e)}"
iface = gr.Interface(
fn=gradio_interface,
inputs="text",
outputs="text",
title="arXiv RAG System",
description="Ask questions about arXiv papers"
)
if __name__ == "__main__":
try:
logging.info("Starting Gradio interface")
iface.launch()
except Exception as e:
logging.error(f"Failed to start Gradio interface: {str(e)}")