Spaces:
Build error
Build error
Updated frontend
Browse files
app.py
CHANGED
@@ -38,6 +38,13 @@ with colu2:
|
|
38 |
st.subheader("Corrected Output")
|
39 |
gemini_output = st.empty()
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Buttons for different functionalities
|
42 |
col1, col2, col3 = st.columns([0.3, 0.3, 0.3])
|
43 |
with col1:
|
@@ -52,12 +59,16 @@ with col1:
|
|
52 |
|
53 |
with col2:
|
54 |
if st.button("Generate Questions"):
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
|
61 |
with col3:
|
62 |
if st.button("Corrected Code"):
|
63 |
logger.info("User requested code correction.")
|
@@ -71,10 +82,11 @@ st.session_state.helpful = st.radio("Were the questions helpful?", ("Yes", "No")
|
|
71 |
if st.button("Submit Feedback"):
|
72 |
if st.session_state.helpful is not None:
|
73 |
try:
|
74 |
-
feedback_collection.insert_one({"helpful": st.session_state.helpful})
|
75 |
st.success("Feedback submitted successfully.")
|
76 |
except Exception as e:
|
77 |
st.error(f"Failed to submit feedback: {e}")
|
|
|
78 |
# Hide Streamlit's default menu and style adjustments for a cleaner look
|
79 |
st.markdown(
|
80 |
"""
|
|
|
38 |
st.subheader("Corrected Output")
|
39 |
gemini_output = st.empty()
|
40 |
|
41 |
+
# Dropdown to select the type of question
|
42 |
+
st.subheader("Select Question Type")
|
43 |
+
question_type = st.selectbox(
|
44 |
+
"Choose the type of questions to generate:",
|
45 |
+
["Logical Questions", "Interview-Based Questions", "Code Analysis Questions"]
|
46 |
+
)
|
47 |
+
|
48 |
# Buttons for different functionalities
|
49 |
col1, col2, col3 = st.columns([0.3, 0.3, 0.3])
|
50 |
with col1:
|
|
|
59 |
|
60 |
with col2:
|
61 |
if st.button("Generate Questions"):
|
62 |
+
logger.info(f"Generating {question_type.lower()}.")
|
63 |
+
try:
|
64 |
+
# Generate questions based on user selection
|
65 |
+
generated_questions = generate_questions(code_input, question_type)
|
66 |
+
st.subheader(f"🤖 Model-Generated {question_type}")
|
67 |
+
st.write(generated_questions)
|
68 |
+
except Exception as e:
|
69 |
+
st.error(f"Error: Could not generate questions: {e}")
|
70 |
+
logger.error(f"Question generation error: {e}")
|
71 |
|
|
|
72 |
with col3:
|
73 |
if st.button("Corrected Code"):
|
74 |
logger.info("User requested code correction.")
|
|
|
82 |
if st.button("Submit Feedback"):
|
83 |
if st.session_state.helpful is not None:
|
84 |
try:
|
85 |
+
feedback_collection.insert_one({"helpful": st.session_state.helpful, "question_type": question_type})
|
86 |
st.success("Feedback submitted successfully.")
|
87 |
except Exception as e:
|
88 |
st.error(f"Failed to submit feedback: {e}")
|
89 |
+
|
90 |
# Hide Streamlit's default menu and style adjustments for a cleaner look
|
91 |
st.markdown(
|
92 |
"""
|