Spaces:
Runtime error
Runtime error
from prompt import reading_comprehension_question_generate_prompt | |
from utils import files_list_to_texts | |
def text_generate(chatbot, text, generate_number, llm): | |
prompt = eval('f"' + reading_comprehension_question_generate_prompt + '"') + '\n\nstop\n\n' + text | |
answer = llm(prompt) | |
chatbot = chatbot + [[text, answer]] | |
return chatbot | |
def files_generate(chatbot, files_list, generate_number, llm): | |
try: | |
texts = files_list_to_texts(files_list) | |
for text in texts: | |
prompt = eval('f"' + reading_comprehension_question_generate_prompt + '"') + '\n\nstop\n\n' + text | |
answer = llm(prompt) | |
chatbot = chatbot + [[text, answer]] | |
except Exception as e: | |
chatbot = chatbot + [[None, f"任务失败,原因:{e}"]] | |
return chatbot | |