rameshmoorthy commited on
Commit
a474bee
1 Parent(s): b193cd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -179,8 +179,8 @@ def bot(history, cross_encoder):
179
  yield history, prompt_html
180
  #store_message(db,history[-1][0],history[-1][1],cross_encoder)
181
 
182
- def system_instructions(question_difficulty, topic,document_summaries):
183
- return f"""<s> [INST] Your are a great teacher and your task is to create 10 questions with 4 choices with a {question_difficulty} difficulty about topic request " {topic} " only from the below given documents, {'\n'.join(document_summaries)} then create an answers. Index in JSON format, the questions as "Q#":"" to "Q#":"", the four choices as "Q#:C1":"" to "Q#:C4":"", and the answers as "A#":"Q#:C#" to "A#":"Q#:C#". [/INST]"""
184
 
185
 
186
  #with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
@@ -315,8 +315,9 @@ with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green",
315
 
316
  documents=[item['content'] for item in documents_full]
317
  document_summaries = [f"[DOCUMENT {i+1}]: {summary}" for i, summary in enumerate(documents)]
 
318
  formatted_prompt = system_instructions(
319
- question_difficulty, topic,document_summaries)
320
  print(formatted_prompt)
321
  pre_prompt = [
322
  {"role": "system", "content": formatted_prompt}
 
179
  yield history, prompt_html
180
  #store_message(db,history[-1][0],history[-1][1],cross_encoder)
181
 
182
+ def system_instructions(question_difficulty, topic,document_str):
183
+ return f"""<s> [INST] Your are a great teacher and your task is to create 10 questions with 4 choices with a {question_difficulty} difficulty about topic request " {topic} " only from the below given documents, {document_str} then create an answers. Index in JSON format, the questions as "Q#":"" to "Q#":"", the four choices as "Q#:C1":"" to "Q#:C4":"", and the answers as "A#":"Q#:C#" to "A#":"Q#:C#". [/INST]"""
184
 
185
 
186
  #with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
 
315
 
316
  documents=[item['content'] for item in documents_full]
317
  document_summaries = [f"[DOCUMENT {i+1}]: {summary}" for i, summary in enumerate(documents)]
318
+ documents_str='\n'.join(document_summaries)
319
  formatted_prompt = system_instructions(
320
+ question_difficulty, topic,document_str)
321
  print(formatted_prompt)
322
  pre_prompt = [
323
  {"role": "system", "content": formatted_prompt}