AptlyDigital commited on
Commit
6da5f9a
·
verified ·
1 Parent(s): aba2598

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +6 -0
  2. README.md +8 -12
  3. app.py +29 -0
  4. requirements.txt +13 -0
Dockerfile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+ WORKDIR /app
3
+ COPY requirements.txt .
4
+ RUN pip install --no-cache-dir -r requirements.txt
5
+ COPY . .
6
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -1,12 +1,8 @@
1
- ---
2
- title: Aitutor
3
- emoji: 🐠
4
- colorFrom: green
5
- colorTo: gray
6
- sdk: docker
7
- pinned: false
8
- license: apache-2.0
9
- short_description: ai tutor
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # AI Tutor Application
2
+
3
+ This is an AI tutor application for exam preparation.
4
+
5
+ ## Features
6
+ - RAG-based question answering
7
+ - PDF and image upload
8
+ - Text-to-speech responses
 
 
 
 
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from documents.loader import DocumentLoader
3
+ from utils.rag_pipeline import RAGPipeline
4
+
5
+ loader = DocumentLoader()
6
+ rag = RAGPipeline()
7
+
8
+ def process_query(question, history):
9
+ return f"AI Tutor: I received your question: {question}"
10
+
11
+ def upload_file(file):
12
+ return f"Uploaded: {file.name}"
13
+
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown("# AI Tutor for Exam Preparation")
16
+ with gr.Row():
17
+ with gr.Column():
18
+ file_input = gr.File(label="Upload PDF/Image")
19
+ upload_btn = gr.Button("Upload")
20
+ upload_output = gr.Textbox(label="Upload Status")
21
+ with gr.Column():
22
+ chatbot = gr.Chatbot()
23
+ msg = gr.Textbox(label="Your question")
24
+ send_btn = gr.Button("Send")
25
+
26
+ upload_btn.click(upload_file, inputs=file_input, outputs=upload_output)
27
+ send_btn.click(process_query, inputs=msg, outputs=chatbot)
28
+
29
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ sentence-transformers
4
+ chromadb
5
+ langchain
6
+ langchain-huggingface
7
+ pillow
8
+ pypdf
9
+ python-multipart
10
+ accelerate
11
+ torch
12
+ datasets
13
+ huggingface-hub