Spaces:
Runtime error
Runtime error
Commit
โข
0c2babc
1
Parent(s):
981bd24
pr #4 (#4)
Browse files- Update (e9ac0832231f280e75e8508773406074ddb5ad9a)
Co-authored-by: Dongwook Chang <[email protected]>
ice_breaking_challenge/__init__.py
CHANGED
@@ -6,8 +6,8 @@ from ice_breaking_challenge.models.model_loader import load_model_with_lora
|
|
6 |
from ice_breaking_challenge.google_sheets import load_google_sheets
|
7 |
|
8 |
model = None
|
9 |
-
quiz_generated = dict
|
10 |
-
quiz_results = dict
|
11 |
|
12 |
def create_app(test_config=None):
|
13 |
"""Create and configure an instance of the Flask application."""
|
@@ -70,6 +70,12 @@ def create_app(test_config=None):
|
|
70 |
from . import introduction
|
71 |
app.register_blueprint(introduction.bp)
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
# make url_for('index') == url_for('blog.index')
|
74 |
# in another app, you might define a separate main index here with
|
75 |
# app.route, while giving the blog blueprint a url_prefix, but for
|
|
|
6 |
from ice_breaking_challenge.google_sheets import load_google_sheets
|
7 |
|
8 |
model = None
|
9 |
+
quiz_generated = dict()
|
10 |
+
quiz_results = dict()
|
11 |
|
12 |
def create_app(test_config=None):
|
13 |
"""Create and configure an instance of the Flask application."""
|
|
|
70 |
from . import introduction
|
71 |
app.register_blueprint(introduction.bp)
|
72 |
|
73 |
+
from . import topic
|
74 |
+
app.register_blueprint(topic.bp)
|
75 |
+
|
76 |
+
from . import quiz
|
77 |
+
app.register_blueprint(quiz.bp)
|
78 |
+
|
79 |
# make url_for('index') == url_for('blog.index')
|
80 |
# in another app, you might define a separate main index here with
|
81 |
# app.route, while giving the blog blueprint a url_prefix, but for
|
ice_breaking_challenge/background_task.py
CHANGED
@@ -29,6 +29,7 @@ def generate_quiz(data):
|
|
29 |
response = model.generate(input_text, max_length=512)
|
30 |
|
31 |
lines = response.split('\n')
|
|
|
32 |
index = lines.index('<response>')
|
33 |
question_generated = lines[index+1]
|
34 |
multiple_choice_generated = lines[index + 2]
|
|
|
29 |
response = model.generate(input_text, max_length=512)
|
30 |
|
31 |
lines = response.split('\n')
|
32 |
+
lines = [line.strip() for line in lines]
|
33 |
index = lines.index('<response>')
|
34 |
question_generated = lines[index+1]
|
35 |
multiple_choice_generated = lines[index + 2]
|
ice_breaking_challenge/qr.py
CHANGED
@@ -35,10 +35,10 @@ def qr() -> None:
|
|
35 |
return render_template("index.html")
|
36 |
if counter[session.get("team_number")] == int(session["team_size"]):
|
37 |
qna = get_questions_and_answers()
|
38 |
-
Thread(target=background_task, args=(session.sid, qna)).start()
|
39 |
-
import time
|
40 |
-
time.sleep(100)
|
41 |
-
return
|
42 |
else:
|
43 |
flash("์ค๋ฌธ์ ์๋ฃํ์ง ์์ ํ์์ด ์์ต๋๋ค.")
|
44 |
return render_template("qr.html")
|
|
|
35 |
return render_template("index.html")
|
36 |
if counter[session.get("team_number")] == int(session["team_size"]):
|
37 |
qna = get_questions_and_answers()
|
38 |
+
Thread(target=background_task.background_task, args=(session.sid, qna)).start()
|
39 |
+
# import time
|
40 |
+
# time.sleep(100)
|
41 |
+
return redirect(url_for("introduction.introduction"))
|
42 |
else:
|
43 |
flash("์ค๋ฌธ์ ์๋ฃํ์ง ์์ ํ์์ด ์์ต๋๋ค.")
|
44 |
return render_template("qr.html")
|
ice_breaking_challenge/templates/topic.html
CHANGED
@@ -1,23 +1,18 @@
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
-
<h1 id="topic"
|
5 |
|
6 |
<script>
|
7 |
-
//
|
8 |
function updateTopic() {
|
9 |
-
|
10 |
-
.
|
11 |
-
|
12 |
-
document.getElementById('topic').textContent = data.topic;
|
13 |
-
})
|
14 |
-
.catch(error => console.error('Error fetching topic:', error));
|
15 |
}
|
16 |
|
17 |
-
// ํ์ด์ง๊ฐ ๋ก๋๋ ๋ ์ฃผ์ ์
๋ฐ์ดํธ
|
18 |
updateTopic();
|
19 |
-
|
20 |
-
// 20์ด๋ง๋ค ์ฃผ์ ์
๋ฐ์ดํธ
|
21 |
-
setInterval(updateTopic, 20000);
|
22 |
</script>
|
23 |
{% endblock %}
|
|
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
+
<h1 id="topic">{{ topic }}</h1>
|
5 |
|
6 |
<script>
|
7 |
+
// 20์ด๋ง๋ค ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ๋ ํจ์
|
8 |
function updateTopic() {
|
9 |
+
setTimeout(() => {
|
10 |
+
window.location.reload(); // ํ์ด์ง๋ฅผ ์๋ก๊ณ ์นจํ์ฌ ์๋ก์ด ์ฃผ์ ๋ฅผ ๋ถ๋ฌ์ด
|
11 |
+
}, 20000); // 20์ด
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
+
// ํ์ด์ง๊ฐ ๋ก๋๋ ๋ ์ฃผ์ ์
๋ฐ์ดํธ ํจ์ ํธ์ถ
|
15 |
updateTopic();
|
|
|
|
|
|
|
16 |
</script>
|
17 |
{% endblock %}
|
18 |
+
|
ice_breaking_challenge/topic.py
CHANGED
@@ -5,7 +5,7 @@ from ice_breaking_challenge import quiz_generated
|
|
5 |
|
6 |
import time
|
7 |
|
8 |
-
bp = Blueprint("topic", __name__, url_prefix="topic")
|
9 |
topics = ["๋ฐ๋ง ๋ชจ๋๋ฅผ ํด๋ณด์๋ ๊ฑด ์ด๋ ์ธ์?", "์ค๋ ๋ฎ์ ํ ์ผ์ ๊ณต์ ํด๋ณด์ธ์!", "์์นจํ ์ธ๊ฐ์ธ๊ฐ์, ์ ๋
ํ ์ธ๊ฐ์ธ๊ฐ์?",
|
10 |
"MBTI๊ฐ ๋ฌด์์ธ๊ฐ์? ๋ํํด๋ณด๋ฉฐ ๋ง์ถฐ๋ณด์ธ์!", "์๋ก์ ์ทจ๋ฏธ๋ฅผ ํ ๊ฐ์ง์ฉ ๊ณต์ ํด๋ณผ๊น์?", "๋์ด๋๊ฐ ์ด๋ป๊ฒ ๋์ธ์? ๋๊ฐ์ด ์๋์ง ์ฐพ์๋ณผ๊น์?",
|
11 |
"์๋ก ์ด๋ฆ ๋์ ๋๋ค์์ ํ๋ ์ ํด์ ๋ถ๋ฌ๋ณผ๊น์?"]
|
@@ -16,6 +16,5 @@ def topic() -> None:
|
|
16 |
return redirect(url_for("quiz.quiz"))
|
17 |
else:
|
18 |
selected_topic = random.choice(topics)
|
19 |
-
time.sleep(20) # 20์ด ๋๊ธฐ ํ ๋ค์ ์ฃผ์ ๋ก
|
20 |
return render_template("topic.html", topic=selected_topic)
|
21 |
|
|
|
5 |
|
6 |
import time
|
7 |
|
8 |
+
bp = Blueprint("topic", __name__, url_prefix="/topic")
|
9 |
topics = ["๋ฐ๋ง ๋ชจ๋๋ฅผ ํด๋ณด์๋ ๊ฑด ์ด๋ ์ธ์?", "์ค๋ ๋ฎ์ ํ ์ผ์ ๊ณต์ ํด๋ณด์ธ์!", "์์นจํ ์ธ๊ฐ์ธ๊ฐ์, ์ ๋
ํ ์ธ๊ฐ์ธ๊ฐ์?",
|
10 |
"MBTI๊ฐ ๋ฌด์์ธ๊ฐ์? ๋ํํด๋ณด๋ฉฐ ๋ง์ถฐ๋ณด์ธ์!", "์๋ก์ ์ทจ๋ฏธ๋ฅผ ํ ๊ฐ์ง์ฉ ๊ณต์ ํด๋ณผ๊น์?", "๋์ด๋๊ฐ ์ด๋ป๊ฒ ๋์ธ์? ๋๊ฐ์ด ์๋์ง ์ฐพ์๋ณผ๊น์?",
|
11 |
"์๋ก ์ด๋ฆ ๋์ ๋๋ค์์ ํ๋ ์ ํด์ ๋ถ๋ฌ๋ณผ๊น์?"]
|
|
|
16 |
return redirect(url_for("quiz.quiz"))
|
17 |
else:
|
18 |
selected_topic = random.choice(topics)
|
|
|
19 |
return render_template("topic.html", topic=selected_topic)
|
20 |
|