Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
import os
|
2 |
-
import streamlit as st
|
3 |
-
import PyPDF2
|
4 |
-
from openai import AzureOpenAI
|
5 |
-
import uuid
|
6 |
-
from typing import List, Dict, Any, Optional
|
7 |
-
from supabase import create_client, Client
|
8 |
-
from dotenv import load_dotenv
|
9 |
import json
|
|
|
|
|
10 |
import re
|
11 |
-
|
|
|
12 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
|
13 |
from queue import Queue
|
14 |
-
import
|
15 |
-
|
16 |
-
import logging
|
17 |
import pandas as pd
|
18 |
import plotly.express as px
|
19 |
-
import
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# Set up logging
|
22 |
logging.basicConfig(
|
@@ -699,20 +699,6 @@ def upload_questions_to_supabase(generated_questions: List[Dict[str, Any]], sour
|
|
699 |
upload_progress.empty()
|
700 |
upload_status.empty()
|
701 |
|
702 |
-
# Run the fix script after upload
|
703 |
-
if successful_uploads > 0:
|
704 |
-
run_fix_script()
|
705 |
-
|
706 |
-
def run_fix_script():
|
707 |
-
"""Run the fix script to improve question quality."""
|
708 |
-
try:
|
709 |
-
from fix import main as fix_main
|
710 |
-
with st.spinner("🔄 Running quality improvement process..."):
|
711 |
-
fix_main()
|
712 |
-
st.success("✅ Successfully completed quality improvement process!")
|
713 |
-
except Exception as e:
|
714 |
-
st.error(f"Error during quality improvement process: {str(e)}")
|
715 |
-
|
716 |
def process_pdfs(pdf_files, exam_type):
|
717 |
"""
|
718 |
Process multiple PDF files and generate questions.
|
@@ -932,7 +918,7 @@ Requirements:
|
|
932 |
- Covers the same concepts in detail
|
933 |
- Maintains similar complexity
|
934 |
- Uses rich context and examples
|
935 |
-
{
|
936 |
|
937 |
2. Write a detailed question that:
|
938 |
- Must be AT LEAST 50 characters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
+
import logging
|
3 |
+
import os
|
4 |
import re
|
5 |
+
import subprocess
|
6 |
+
import uuid
|
7 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
8 |
+
from io import BytesIO
|
9 |
from queue import Queue
|
10 |
+
from typing import Any, Dict, List, Optional
|
11 |
+
|
|
|
12 |
import pandas as pd
|
13 |
import plotly.express as px
|
14 |
+
import PyPDF2
|
15 |
+
import streamlit as st
|
16 |
+
from dotenv import load_dotenv
|
17 |
+
from openai import AzureOpenAI
|
18 |
+
from pydantic import BaseModel
|
19 |
+
from supabase import Client, create_client
|
20 |
|
21 |
# Set up logging
|
22 |
logging.basicConfig(
|
|
|
699 |
upload_progress.empty()
|
700 |
upload_status.empty()
|
701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
def process_pdfs(pdf_files, exam_type):
|
703 |
"""
|
704 |
Process multiple PDF files and generate questions.
|
|
|
918 |
- Covers the same concepts in detail
|
919 |
- Maintains similar complexity
|
920 |
- Uses rich context and examples
|
921 |
+
{"- Incorporates the special instructions provided above" if prompt else ""}
|
922 |
|
923 |
2. Write a detailed question that:
|
924 |
- Must be AT LEAST 50 characters
|