AIQuizGenerator / app.py
Rehman1603's picture
Update app.py
ce34226 verified
from fileCreator import GenerateSQDocument,GenerateParaphraseDocument,GenerateMCQSDocument
from main import predict_shortq,paraphrase,predict_mcq
import gradio as gr
import os
def QuizGenerator(data,Choice):
text={
"input_text":data
}
result={}
path=""
if(Choice=="MCQS"):
result=predict_mcq(text)
GenerateMCQSDocument(result)
path="Document.docx"
elif(Choice=="SQ"):
result=predict_shortq(text)
GenerateSQDocument(result)
path="Document1.docx"
elif(Choice=="PharaphraseQuestion"):
result=paraphrase(text)
GenerateParaphraseDocument(result)
path="Document2.docx"
return path
interface=gr.Interface(fn=QuizGenerator,
inputs=[gr.components.Textbox(label="Type The Data here.."),gr.components.Radio(['MCQS','SQ','PharaphraseQuestion'],type="value")],
outputs="file",
examples=[
['Artificial intelligence is the science of making machines that can think like humans. It can do things that are considered "smart." AI technology can process large amounts of data in ways, unlike humans. The goal for AI is to be able to do things such as recognize patterns, make decisions, and judge like humans.','SQ'],
])
interface.launch(debug=True)