Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,8 @@ import pdfplumber
|
|
| 10 |
from langchain_groq import ChatGroq
|
| 11 |
from langchain_community.utilities import SerpAPIWrapper
|
| 12 |
from langchain_core.messages import HumanMessage
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Initialize models (will use environment variables)
|
| 15 |
def init_models():
|
|
@@ -21,7 +23,7 @@ def init_models():
|
|
| 21 |
|
| 22 |
model_question_gen = ChatGroq(model="llama-3.3-70b-versatile", api_key=groq_key)
|
| 23 |
model_answer_gen = ChatGroq(model="llama-3.3-70b-versatile", api_key=groq_key)
|
| 24 |
-
model_trend_analyzer = ChatGroq(model="
|
| 25 |
serp = SerpAPIWrapper(serpapi_api_key=serp_key)
|
| 26 |
|
| 27 |
return model_question_gen, model_answer_gen, model_trend_analyzer, serp
|
|
@@ -221,33 +223,37 @@ def generate_exam(exam_mode, subject, code, units, numA, numB, numC, syllabus_fi
|
|
| 221 |
except Exception as e:
|
| 222 |
return None, f"❌ Error: {str(e)}"
|
| 223 |
|
| 224 |
-
# Custom CSS
|
| 225 |
-
custom_css = """
|
| 226 |
-
.gradio-container {
|
| 227 |
-
font-family: 'Inter', sans-serif;
|
| 228 |
-
max-width: 1200px !important;
|
| 229 |
-
}
|
| 230 |
-
.header-text {
|
| 231 |
-
text-align: center;
|
| 232 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 233 |
-
color: white;
|
| 234 |
-
padding: 2rem;
|
| 235 |
-
border-radius: 10px;
|
| 236 |
-
margin-bottom: 2rem;
|
| 237 |
-
}
|
| 238 |
-
.feature-box {
|
| 239 |
-
background: #f8f9fa;
|
| 240 |
-
padding: 1rem;
|
| 241 |
-
border-radius: 8px;
|
| 242 |
-
border-left: 4px solid #667eea;
|
| 243 |
-
}
|
| 244 |
-
"""
|
| 245 |
|
| 246 |
# Create Gradio interface
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
gr.HTML("""
|
| 249 |
<div class="header-text">
|
| 250 |
-
<h1
|
| 251 |
<p>AI-Powered Question Paper & Answer Key Generator</p>
|
| 252 |
<p style="font-size: 0.9rem; opacity: 0.9;">Powered by Advanced LLM Technology | Industry-Standard Framework</p>
|
| 253 |
</div>
|
|
@@ -303,7 +309,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
| 303 |
gr.Markdown("""
|
| 304 |
---
|
| 305 |
<center>
|
| 306 |
-
<p style="color: #666;">Developed with ❤️
|
| 307 |
</center>
|
| 308 |
""")
|
| 309 |
|
|
|
|
| 10 |
from langchain_groq import ChatGroq
|
| 11 |
from langchain_community.utilities import SerpAPIWrapper
|
| 12 |
from langchain_core.messages import HumanMessage
|
| 13 |
+
import warnings
|
| 14 |
+
warnings.filterwarnings('ignore')
|
| 15 |
|
| 16 |
# Initialize models (will use environment variables)
|
| 17 |
def init_models():
|
|
|
|
| 23 |
|
| 24 |
model_question_gen = ChatGroq(model="llama-3.3-70b-versatile", api_key=groq_key)
|
| 25 |
model_answer_gen = ChatGroq(model="llama-3.3-70b-versatile", api_key=groq_key)
|
| 26 |
+
model_trend_analyzer = ChatGroq(model="llama-3.3-70b-versatile", api_key=groq_key)
|
| 27 |
serp = SerpAPIWrapper(serpapi_api_key=serp_key)
|
| 28 |
|
| 29 |
return model_question_gen, model_answer_gen, model_trend_analyzer, serp
|
|
|
|
| 223 |
except Exception as e:
|
| 224 |
return None, f"❌ Error: {str(e)}"
|
| 225 |
|
| 226 |
+
# Custom CSS (removed from old location)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
# Create Gradio interface
|
| 229 |
+
demo = gr.Blocks(theme=gr.themes.Soft())
|
| 230 |
+
|
| 231 |
+
with demo:
|
| 232 |
+
gr.HTML("""
|
| 233 |
+
<style>
|
| 234 |
+
.gradio-container {
|
| 235 |
+
font-family: 'Inter', sans-serif;
|
| 236 |
+
max-width: 1200px !important;
|
| 237 |
+
}
|
| 238 |
+
.header-text {
|
| 239 |
+
text-align: center;
|
| 240 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 241 |
+
color: white;
|
| 242 |
+
padding: 2rem;
|
| 243 |
+
border-radius: 10px;
|
| 244 |
+
margin-bottom: 2rem;
|
| 245 |
+
}
|
| 246 |
+
.feature-box {
|
| 247 |
+
background: #f8f9fa;
|
| 248 |
+
padding: 1rem;
|
| 249 |
+
border-radius: 8px;
|
| 250 |
+
border-left: 4px solid #667eea;
|
| 251 |
+
}
|
| 252 |
+
</style>
|
| 253 |
+
""")
|
| 254 |
gr.HTML("""
|
| 255 |
<div class="header-text">
|
| 256 |
+
<h1>SNS Technology - AI Powered Q&A Agent</h1>
|
| 257 |
<p>AI-Powered Question Paper & Answer Key Generator</p>
|
| 258 |
<p style="font-size: 0.9rem; opacity: 0.9;">Powered by Advanced LLM Technology | Industry-Standard Framework</p>
|
| 259 |
</div>
|
|
|
|
| 309 |
gr.Markdown("""
|
| 310 |
---
|
| 311 |
<center>
|
| 312 |
+
<p style="color: #666;">Developed with ❤️ by VEERAKUMAR C B | © 2024</p>
|
| 313 |
</center>
|
| 314 |
""")
|
| 315 |
|