Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
""
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 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()
|