Raghu-Shikari commited on
Commit
648d0d6
·
verified ·
1 Parent(s): 6a0291c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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 question generation
5
- question_generator = pipeline("text2text-generation", model="valhalla/t5-small-qg-hl")
6
 
7
  # Function to generate MCQs
8
  def generate_mcqs(content, num_questions):
9
- # Generate questions with beam search
10
- questions = question_generator(content, max_length=512, num_return_sequences=num_questions, num_beams=num_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
+