SinaRp commited on
Commit
c5f0901
·
verified ·
1 Parent(s): 28f531e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -14,16 +14,20 @@ def generate_questions(context, num_questions):
14
  except Exception as e:
15
  return f"Error generating questions: {str(e)}"
16
 
17
- with gr.Blocks(css="""
18
- [dir="rtl"] {
19
- direction: rtl;
20
- }
21
- """) as iface:
22
- with gr.Row():
23
- with gr.Column():
24
- context = gr.Textbox(lines=5, label="Text Context", dir="rtl")
25
- with gr.Column():
26
- num_questions = gr.Slider(minimum=1, maximum=5, step=1, label="Number of Questions")
27
- output = gr.Textbox(label="Generated Questions", dir="rtl")
 
 
 
28
 
 
29
  iface.launch()
 
14
  except Exception as e:
15
  return f"Error generating questions: {str(e)}"
16
 
17
+ iface = gr.Interface(
18
+ fn=generate_questions,
19
+ inputs=[
20
+ gr.Textbox(lines=5, label="Enter your text context"),
21
+ gr.Slider(minimum=1, maximum=5, value=3, step=1, label="Number of questions")
22
+ ],
23
+ outputs=gr.Textbox(label="Generated Questions"),
24
+ title="Question Generator",
25
+ description="Generate questions from your text using AI",
26
+ examples=[
27
+ ["The Sun is the star at the center of the Solar System. It is a nearly perfect sphere of hot plasma, heated to incandescence by nuclear fusion reactions in its core.", 2],
28
+ ["Machine learning is a subset of artificial intelligence that focuses on the use of data and algorithms to imitate the way that humans learn.", 3]
29
+ ]
30
+ )
31
 
32
+ if __name__ == "__main__":
33
  iface.launch()