yunzi7 dongwook-chan commited on
Commit
0c2babc
โ€ข
1 Parent(s): 981bd24
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 render_template("introduction.html")
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">์ฃผ์ œ๊ฐ€ ์—ฌ๊ธฐ์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค</h1>
5
 
6
  <script>
7
- // ์ฃผ์ œ ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜
8
  function updateTopic() {
9
- fetch('/get_topic')
10
- .then(response => response.json())
11
- .then(data => {
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