mou3az commited on
Commit
796875e
·
verified ·
1 Parent(s): 7168597

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -36
app.py CHANGED
@@ -42,6 +42,7 @@ def generate_quiz(context):
42
 
43
  return response
44
 
 
45
  @app.route("/", methods=["GET", "POST"])
46
  def generate_quiz_page():
47
  if request.method == "POST":
@@ -68,14 +69,28 @@ def generate_quiz_page():
68
  border-radius: 5px;
69
  }}
70
  form {{
71
- background-color: #fff; /* White background for form */
 
 
 
72
  padding: 20px;
73
  border-radius: 5px;
74
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
 
 
 
 
75
  }}
76
- label {{
77
- display: block;
78
- margin-bottom: 10px;
 
 
 
 
 
 
 
79
  }}
80
  textarea {{
81
  width: 100%;
@@ -83,6 +98,7 @@ def generate_quiz_page():
83
  border: 1px solid #ccc;
84
  border-radius: 4px;
85
  resize: vertical; /* Allow vertical resizing of textarea */
 
86
  }}
87
  input[type="submit"] {{
88
  background-color: #ffc107; /* Yellow background for submit button */
@@ -95,29 +111,18 @@ def generate_quiz_page():
95
  input[type="submit"]:hover {{
96
  background-color: #ffca28; /* Lighter yellow on hover */
97
  }}
98
- pre {{
99
- background-color: #fff; /* White background for quiz response */
100
- padding: 20px;
101
- border-radius: 5px;
102
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
103
- }}
104
- a {{
105
- color: #ffc107; /* Yellow text color for links */
106
- text-decoration: none;
107
- }}
108
- a:hover {{
109
- text-decoration: underline; /* Underline on hover */
110
- }}
111
  </style>
112
  </head>
113
  <body>
114
- <h2>Generated Quiz</h2>
115
- <pre>{response}</pre>
116
- <p><a href="/">Back to generate another quiz</a></p>
 
 
117
  <h2>Generate Quiz</h2>
118
  <form action="/" method="post">
119
  <label for="context">Context:</label><br>
120
- <textarea id="context" name="context" rows="4" cols="50" required></textarea><br><br>
121
  <input type="submit" value="Generate Quiz">
122
  </form>
123
  </body>
@@ -151,6 +156,7 @@ def generate_quiz_page():
151
  padding: 20px;
152
  border-radius: 5px;
153
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
 
154
  }
155
  label {
156
  display: block;
@@ -162,6 +168,7 @@ def generate_quiz_page():
162
  border: 1px solid #ccc;
163
  border-radius: 4px;
164
  resize: vertical; /* Allow vertical resizing of textarea */
 
165
  }
166
  input[type="submit"] {
167
  background-color: #ffc107; /* Yellow background for submit button */
@@ -174,26 +181,13 @@ def generate_quiz_page():
174
  input[type="submit"]:hover {
175
  background-color: #ffca28; /* Lighter yellow on hover */
176
  }
177
- pre {
178
- background-color: #fff; /* White background for quiz response */
179
- padding: 20px;
180
- border-radius: 5px;
181
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
182
- }
183
- a {
184
- color: #ffc107; /* Yellow text color for links */
185
- text-decoration: none;
186
- }
187
- a:hover {
188
- text-decoration: underline; /* Underline on hover */
189
- }
190
  </style>
191
  </head>
192
  <body>
193
  <h2>Generate Quiz</h2>
194
  <form action="/" method="post">
195
  <label for="context">Context:</label><br>
196
- <textarea id="context" name="context" rows="4" cols="50" required></textarea><br><br>
197
  <input type="submit" value="Generate Quiz">
198
  </form>
199
  </body>
@@ -203,4 +197,4 @@ def generate_quiz_page():
203
  return default_html
204
 
205
  if __name__ == "__main__":
206
- app.run(debug=True)
 
42
 
43
  return response
44
 
45
+
46
  @app.route("/", methods=["GET", "POST"])
47
  def generate_quiz_page():
48
  if request.method == "POST":
 
69
  border-radius: 5px;
70
  }}
71
  form {{
72
+ display: none; /* Hide the form after generating quiz */
73
+ }}
74
+ .quiz-container {{
75
+ background-color: #fff; /* White background for quiz response */
76
  padding: 20px;
77
  border-radius: 5px;
78
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
79
+ margin-bottom: 20px;
80
+ }}
81
+ .quiz-container pre {{
82
+ white-space: pre-wrap; /* Preserve line breaks in quiz response */
83
  }}
84
+ .generate-link {{
85
+ display: block; /* Make the link block-level for spacing */
86
+ margin-top: 10px;
87
+ }}
88
+ a {{
89
+ color: #ffc107; /* Yellow text color for links */
90
+ text-decoration: none;
91
+ }}
92
+ a:hover {{
93
+ text-decoration: underline; /* Underline on hover */
94
  }}
95
  textarea {{
96
  width: 100%;
 
98
  border: 1px solid #ccc;
99
  border-radius: 4px;
100
  resize: vertical; /* Allow vertical resizing of textarea */
101
+ min-height: 150px; /* Minimum height for textarea */
102
  }}
103
  input[type="submit"] {{
104
  background-color: #ffc107; /* Yellow background for submit button */
 
111
  input[type="submit"]:hover {{
112
  background-color: #ffca28; /* Lighter yellow on hover */
113
  }}
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </style>
115
  </head>
116
  <body>
117
+ <div class="quiz-container">
118
+ <h2>Generated Quiz</h2>
119
+ <pre>{response}</pre>
120
+ <a href="/" class="generate-link">Generate another quiz</a>
121
+ </div>
122
  <h2>Generate Quiz</h2>
123
  <form action="/" method="post">
124
  <label for="context">Context:</label><br>
125
+ <textarea id="context" name="context" rows="6" required></textarea><br><br>
126
  <input type="submit" value="Generate Quiz">
127
  </form>
128
  </body>
 
156
  padding: 20px;
157
  border-radius: 5px;
158
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light shadow effect */
159
+ margin-bottom: 20px;
160
  }
161
  label {
162
  display: block;
 
168
  border: 1px solid #ccc;
169
  border-radius: 4px;
170
  resize: vertical; /* Allow vertical resizing of textarea */
171
+ min-height: 150px; /* Minimum height for textarea */
172
  }
173
  input[type="submit"] {
174
  background-color: #ffc107; /* Yellow background for submit button */
 
181
  input[type="submit"]:hover {
182
  background-color: #ffca28; /* Lighter yellow on hover */
183
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  </style>
185
  </head>
186
  <body>
187
  <h2>Generate Quiz</h2>
188
  <form action="/" method="post">
189
  <label for="context">Context:</label><br>
190
+ <textarea id="context" name="context" rows="6" required></textarea><br><br>
191
  <input type="submit" value="Generate Quiz">
192
  </form>
193
  </body>
 
197
  return default_html
198
 
199
  if __name__ == "__main__":
200
+ app.run(debug=True)