An open API service indexing awesome lists of open source software.

https://github.com/suryask007/rag-with-tts

AI-Powered Q&A with File Upload
https://github.com/suryask007/rag-with-tts

fastapi python rag-chatbot streamlit text-to-speech

Last synced: 2 months ago
JSON representation

AI-Powered Q&A with File Upload

Awesome Lists containing this project

README

          

## **AI-Powered Q&A with File Upload**

## **📌 Description**

The AI-Powered Q&A with File Upload is an advanced Streamlit-based web application that allows users to upload PDF files, ask questions related to the content, and receive answers in both text and audio formats. This system leverages FastAPI for backend processing and a Text-to-Speech (TTS) module for audio responses. It provides an interactive and efficient way to extract and interpret information from documents.

---

## **🚀 Features**

✅ **Upload PDF Files** – Users can upload multiple PDFs for processing.

✅ **File Processing via FastAPI** – The backend extracts information from PDFs.

✅ **AI-Powered Q&A** – Users can ask questions based on the uploaded PDFs, and the system returns answers.

✅ **Text-to-Speech (TTS) Support** – Converts the answer into audio format for playback.

---

## **🔧 Prerequisites**

Ensure you have the following installed:

- **Python 3.8+**
- **pip** (Python package manager)

---

## **📥 Installation**

Clone the repository:

```bash
git clone https://github.com/suryask007/RAG-with-TTS.git
cd RAG-with-TTS
```

Install the required dependencies:

```bash
pip install -r requirements.txt
```

---

## **▶️ Running the Application**

Run the `root.py` script, which starts both **FastAPI and Streamlit**:

```bash
python root.py
```

---

## **🛠️ Usage**

1️⃣ **Upload PDFs** – Click on the upload button and select PDF files.

2️⃣ **Process Files** – The app sends the files to FastAPI for processing.

3️⃣ **Ask a Question** – Enter a question related to the uploaded files.

4️⃣ **Get Text Answer** – The model will return an answer based on the PDFs.

5️⃣ **Generate Audio Answer** – Click on "Get Audio Answer" to listen to the response.

---

## **🔗 API Endpoints**

- **`POST /file_upload`** → Uploads and processes PDFs.
- **`POST /model`** → Takes a question and returns an answer.
- **`GET /audio`** → Converts the text answer to an audio response.

---

## **⚠️ Troubleshooting**

⚡ **App restarts on button clicks** – This is due to Streamlit's rerun behavior. The app uses `st.session_state` to prevent reprocessing on every button click.

⚡ **FastAPI Not Running** – Ensure FastAPI is running before launching Streamlit.

⚡ **Audio Not Playing** – If `pydub` fails, download the file manually from the UI.

---

## **👨‍💻 Contributors**

- **Surya K** (surya.tvm.apm@gmail.com)