Rehman1603 commited on
Commit
46fb916
1 Parent(s): f5f2174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fileCreator import GenerateSQDocument,GenerateParaphraseDocument,GenerateMCQSDocument
2
+ from main import predict_shortq,paraphrase,predict_mcq
3
+ import gradio as gr
4
+
5
+
6
+ def QuizGenerator(data,Choice):
7
+ text={
8
+ "input_text":data
9
+ }
10
+ Choice="MCQS"
11
+ result={}
12
+ path=""
13
+ if(Choice=="MCQS"):
14
+ result=predict_mcq(text)
15
+ GenerateMCQSDocument(result)
16
+ path="Document.docx"
17
+ elif(Choice=="SQ"):
18
+ result=predict_shortq(text)
19
+ GenerateSQDocument(result)
20
+ path="Document1.docx"
21
+ elif(Choice=="PharaphraseQuestion"):
22
+ result=paraphrase(text)
23
+ GenerateParaphraseDocument(result)
24
+ path="Document2.docx"
25
+ return path
26
+
27
+ interface=gr.Interface(fn=QuizGenerator,
28
+ inputs=[gr.components.Textbox(label="Type The Data here.."),gr.components.Radio(['MCQS','SQ','PharaphraseQuestion'],type="value")],
29
+ outputs="file")
30
+ interface.launch(debug=True)