Siddiqui Qamar commited on
Commit
246ef24
·
verified ·
1 Parent(s): eea8826

Adjusting no of tokens for speedy generation.

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -47,12 +47,12 @@ def generate_study_material(
47
  Generate questions following these guidelines:
48
  1. Start with a brief confidence-building message
49
  2. Include clear, unambiguous questions
50
- 3. Provide detailed explanations for each answer
51
  4. Add study tips relevant to the topic
52
  5. Include a "Remember" section with key points
53
 
54
  Format:
55
- - For Multiple Choice: Include 4 options with explanations for each
56
  - For Short Answer: Provide structure hints and model answers
57
  - For Descriptive: Break down marking criteria and include outline points
58
 
@@ -72,7 +72,7 @@ def generate_study_material(
72
  response = client.chat.completions.create(
73
  model="Qwen/QwQ-32B-Preview",
74
  messages=messages,
75
- max_tokens=2048,
76
  temperature=0.7,
77
  top_p=0.9
78
  )
@@ -80,7 +80,7 @@ def generate_study_material(
80
  return response.choices[0].message.content
81
 
82
  except Exception as e:
83
- return f"An error occurred: {str(e)}\nPlease try again with different parameters."
84
 
85
  def create_interface():
86
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as iface:
@@ -137,8 +137,8 @@ def create_interface():
137
  )
138
 
139
  num_questions = gr.Slider(
140
- minimum=3,
141
- maximum=10,
142
  value=5,
143
  step=1,
144
  label="Number of Questions"
 
47
  Generate questions following these guidelines:
48
  1. Start with a brief confidence-building message
49
  2. Include clear, unambiguous questions
50
+ 3. Provide detailed explanations for correct answer
51
  4. Add study tips relevant to the topic
52
  5. Include a "Remember" section with key points
53
 
54
  Format:
55
+ - For Multiple Choice: Include 4 options with explanations for correct one only
56
  - For Short Answer: Provide structure hints and model answers
57
  - For Descriptive: Break down marking criteria and include outline points
58
 
 
72
  response = client.chat.completions.create(
73
  model="Qwen/QwQ-32B-Preview",
74
  messages=messages,
75
+ max_tokens=1700,
76
  temperature=0.7,
77
  top_p=0.9
78
  )
 
80
  return response.choices[0].message.content
81
 
82
  except Exception as e:
83
+ return f"An error occurred: {str(e)}\nServer is bussy! Please come back later."
84
 
85
  def create_interface():
86
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as iface:
 
137
  )
138
 
139
  num_questions = gr.Slider(
140
+ minimum=1,
141
+ maximum=3,
142
  value=5,
143
  step=1,
144
  label="Number of Questions"