AIQuizGenerator / app.py
Rehman1603's picture
Update app.py
c7b249d verified
raw history blame
No virus
916 Bytes
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
}
Choice="MCQS"
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")
interface.launch(debug=True)