Innopolis University DevOps Playground
Skip to content
Snippets Groups Projects
Commit 6a53ecb5 authored by Saveliy's avatar Saveliy
Browse files

Bugs with checking GPT generative.

parent 4586f685
Branches add-gptgener-checking
No related tags found
1 merge request!9Add GPT generating
......@@ -60,10 +60,17 @@ async def gpt_checker_end(update, context):
pdf_file = PDF(file_path, int(1))
pdf_file.parsingQuestions()
ai_checker = QuestionsChecker(pdf_file)
res = ai_checker.gpt_generating_checking()
os.remove(file_path)
print(res)
res = int(res)
if res == 0:
await update.message.reply_text('✅ Everything is fine!')
elif res == 1:
......
......@@ -15,16 +15,17 @@ class QuestionsChecker:
self.model = genai.GenerativeModel("gemini-1.5-flash")
def gpt_generating_checking(self) -> str:
question = f"Check this text for GPT generation:"
question = f"Check this text for GPT generation:\n"
for q in self._RQ.questions.keys():
question += f'{q}:{self._RQ.questions[q]}\n'
question = ("Output one number in response"
f": 0, if the text was not generated, "
f"1 if the probability that the text was generated is very small, "
f"2 if the probability that the text was generated is average"
f", 3, if the text was definitely generated")
question += ("Output one number in response"
f": 0, if the text was not generated, "
f"1 if the probability that the text was generated is very small, "
f"2 if the probability that the text was generated is average"
f", 3, if the text was definitely generated. in your answer write only one number without any "
f"additional text")
response = self.model.generate_content(question)
......
......@@ -38,4 +38,6 @@ if __name__ == '__main__':
fallbacks=[CommandHandler('cancel', cancel)]
)
app.add_handler(conv_handler)
app.run_polling()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment