AIQuizGenerator / app.py
Rehman1603's picture
Update app.py
499fcd8 verified
raw
history blame
1.24 kB
from fileCreator import GenerateSQDocument,GenerateParaphraseDocument,GenerateMCQSDocument
from main import predict_shortq,paraphrase,predict_mcq
import gradio as gr
import os
os.system('pip install git+https://github.com/boudinfl/pke.git')
os.system('python -m nltk.downloader universal_tagset')
os.system('python -m spacy download en')
os.system('wget https://github.com/explosion/sense2vec/releases/download/v1.0.0/s2v_reddit_2015_md.tar.gz')
os.system('tar -xvf s2v_reddit_2015_md.tar.gz')
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)