Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load the Hugging Face model for
|
5 |
-
|
6 |
|
7 |
# Function to generate MCQs
|
8 |
def generate_mcqs(content, num_questions):
|
9 |
-
|
10 |
-
questions =
|
11 |
return questions
|
12 |
|
13 |
# Streamlit UI
|
@@ -27,3 +27,4 @@ if st.button("Generate MCQs"):
|
|
27 |
|
28 |
|
29 |
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the Hugging Face model for text generation
|
5 |
+
pipe = pipeline("text-generation", model="google/gemma-2-27b-it")
|
6 |
|
7 |
# Function to generate MCQs
|
8 |
def generate_mcqs(content, num_questions):
|
9 |
+
messages = [{"role": "user", "content": content}]
|
10 |
+
questions = pipe(messages, max_length=512, num_return_sequences=num_questions, num_beams=num_questions)
|
11 |
return questions
|
12 |
|
13 |
# Streamlit UI
|
|
|
27 |
|
28 |
|
29 |
|
30 |
+
|