Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -319,15 +319,7 @@ with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green",
|
|
| 319 |
RAG_db_=RAG_db.value
|
| 320 |
documents_full=RAG_db_.search(topic,k=top_k_rank)
|
| 321 |
|
| 322 |
-
|
| 323 |
-
document_summaries = [f"[DOCUMENT {i+1}]: {summary}" for i, summary in enumerate(documents)]
|
| 324 |
-
documents_str='\n'.join(document_summaries)
|
| 325 |
-
formatted_prompt = system_instructions(
|
| 326 |
-
question_difficulty, topic,documents_str)
|
| 327 |
-
print(formatted_prompt)
|
| 328 |
-
pre_prompt = [
|
| 329 |
-
{"role": "system", "content": formatted_prompt}
|
| 330 |
-
]
|
| 331 |
|
| 332 |
generate_kwargs = dict(
|
| 333 |
temperature=0.2,
|
|
@@ -341,6 +333,15 @@ with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green",
|
|
| 341 |
count=0
|
| 342 |
while count<=3:
|
| 343 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
response = client.text_generation(
|
| 345 |
formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False,
|
| 346 |
)
|
|
|
|
| 319 |
RAG_db_=RAG_db.value
|
| 320 |
documents_full=RAG_db_.search(topic,k=top_k_rank)
|
| 321 |
|
| 322 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
|
| 324 |
generate_kwargs = dict(
|
| 325 |
temperature=0.2,
|
|
|
|
| 333 |
count=0
|
| 334 |
while count<=3:
|
| 335 |
try:
|
| 336 |
+
documents=[item['content'] for item in documents_full]
|
| 337 |
+
document_summaries = [f"[DOCUMENT {i+1}]: {summary}{count}" for i, summary in enumerate(documents)]
|
| 338 |
+
documents_str='\n'.join(document_summaries)
|
| 339 |
+
formatted_prompt = system_instructions(
|
| 340 |
+
question_difficulty, topic,documents_str)
|
| 341 |
+
print(formatted_prompt)
|
| 342 |
+
pre_prompt = [
|
| 343 |
+
{"role": "system", "content": formatted_prompt}
|
| 344 |
+
]
|
| 345 |
response = client.text_generation(
|
| 346 |
formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False,
|
| 347 |
)
|