Spaces:
Sleeping
Sleeping
NCTCMumbai
commited on
Commit
•
f601cce
1
Parent(s):
6ac1d23
Update app.py
Browse files
app.py
CHANGED
@@ -397,6 +397,7 @@ from pathlib import Path
|
|
397 |
from ragatouille import RAGPretrainedModel
|
398 |
from gradio_client import Client
|
399 |
from jinja2 import Environment, FileSystemLoader
|
|
|
400 |
|
401 |
VECTOR_COLUMN_NAME = "vector"
|
402 |
TEXT_COLUMN_NAME = "text"
|
@@ -426,7 +427,7 @@ RAG_db = gr.State()
|
|
426 |
def json_to_excel(output_json):
|
427 |
# Initialize list for DataFrame
|
428 |
data = []
|
429 |
-
|
430 |
for i in range(1, 11): # Assuming there are 10 questions
|
431 |
question_key = f"Q{i}"
|
432 |
answer_key = f"A{i}"
|
@@ -466,11 +467,14 @@ def json_to_excel(output_json):
|
|
466 |
"Time in seconds",
|
467 |
"Image Link"
|
468 |
])
|
|
|
|
|
|
|
469 |
|
470 |
-
# Save to Excel file
|
471 |
-
excel_path = proj_dir / "quiz_questions.xlsx"
|
472 |
-
df.to_excel(str(excel_path), index=False)
|
473 |
-
return
|
474 |
|
475 |
with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green", secondary_hue="green"), css="style.css") as QUIZBOT:
|
476 |
def load_model():
|
@@ -509,7 +513,7 @@ with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green",
|
|
509 |
RAG_db_ = RAG_db.value
|
510 |
documents_full = RAG_db_.search(topic, k=top_k_rank)
|
511 |
|
512 |
-
gr.Warning('Generation of Quiz may take 1 to 2 minutes. Please wait.')
|
513 |
|
514 |
question_radio_list = []
|
515 |
excel_file = None
|
|
|
397 |
from ragatouille import RAGPretrainedModel
|
398 |
from gradio_client import Client
|
399 |
from jinja2 import Environment, FileSystemLoader
|
400 |
+
from tempfile import NamedTemporaryFile
|
401 |
|
402 |
VECTOR_COLUMN_NAME = "vector"
|
403 |
TEXT_COLUMN_NAME = "text"
|
|
|
427 |
def json_to_excel(output_json):
|
428 |
# Initialize list for DataFrame
|
429 |
data = []
|
430 |
+
gr.Warning('Generating Shareable file link..',duration=30)
|
431 |
for i in range(1, 11): # Assuming there are 10 questions
|
432 |
question_key = f"Q{i}"
|
433 |
answer_key = f"A{i}"
|
|
|
467 |
"Time in seconds",
|
468 |
"Image Link"
|
469 |
])
|
470 |
+
# Create a temporary file and save the DataFrame to it
|
471 |
+
temp_file = NamedTemporaryFile(delete=False, suffix=".xlsx")
|
472 |
+
df.to_excel(temp_file.name, index=False)
|
473 |
|
474 |
+
# # Save to Excel file
|
475 |
+
# excel_path = proj_dir / "quiz_questions.xlsx"
|
476 |
+
# df.to_excel(str(excel_path), index=False)
|
477 |
+
return temp_file.name
|
478 |
|
479 |
with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green", secondary_hue="green"), css="style.css") as QUIZBOT:
|
480 |
def load_model():
|
|
|
513 |
RAG_db_ = RAG_db.value
|
514 |
documents_full = RAG_db_.search(topic, k=top_k_rank)
|
515 |
|
516 |
+
gr.Warning('Generation of Quiz may take 1 to 2 minutes. Please wait.',duration=60)
|
517 |
|
518 |
question_radio_list = []
|
519 |
excel_file = None
|