CSB261 commited on
Commit
c8d5f7e
·
verified ·
1 Parent(s): f4e6cb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -38
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from flask import Flask, render_template, request
2
 
3
  app = Flask(__name__)
4
 
@@ -30,13 +30,21 @@ def index():
30
  클로드모델_결과 = 클로드모델_처리(input_text)
31
  딥시크모델_결과 = 딥시크모델_처리(input_text)
32
 
33
- # 결과를 result.html에 전달
34
- return render_template('result.html',
35
- 일반모델_결과=일반모델_결과,
36
- 코히어모델_결과=코히어모델_결과,
37
- 지피티모델_결과=지피티모델_결과,
38
- 클로드모델_결과=클로드모델_결과,
39
- 딥시크모델_결과=딥시크모델_결과)
 
 
 
 
 
 
 
 
40
 
41
  return '''
42
  <!DOCTYPE html>
@@ -47,7 +55,7 @@ def index():
47
  </head>
48
  <body>
49
  <h1>참조글을 입력하세요</h1>
50
- <form method="post" action="/">
51
  <label>
52
  <strong>참조글:</strong><br>
53
  <textarea name="reference_text" rows="10" cols="50"></textarea>
@@ -59,33 +67,5 @@ def index():
59
  </html>
60
  '''
61
 
62
- @app.route('/result')
63
- def result():
64
- 일반모델_결과 = request.args.get('일반모델_결과', '')
65
- 코히어모델_결과 = request.args.get('코히어모델_결과', '')
66
- 지피티모델_결과 = request.args.get('지피티모델_결과', '')
67
- 클로드모델_결과 = request.args.get('클로드모델_결과', '')
68
- 딥시크모델_결과 = request.args.get('딥시크모델_결과', '')
69
-
70
- return f'''
71
- <!DOCTYPE html>
72
- <html lang="ko">
73
- <head>
74
- <meta charset="UTF-8">
75
- <title>생성된 블로그</title>
76
- </head>
77
- <body>
78
- <h1>모델 처리 결과</h1>
79
- <p><strong>일반모델:</strong> {일반모델_결과}</p>
80
- <p><strong>코히어모델:</strong> {코히어모델_결과}</p>
81
- <p><strong>지피티모델:</strong> {지피티모델_결과}</p>
82
- <p><strong>클로드모델:</strong> {클로드모델_결과}</p>
83
- <p><strong>딥시크모델:</strong> {딥시크모델_결과}</p>
84
- <a href="/">다시 입력하기</a>
85
- </body>
86
- </html>
87
- '''
88
-
89
  if __name__ == '__main__':
90
- app.run(debug=True)
91
-
 
1
+ from flask import Flask, request, render_template_string
2
 
3
  app = Flask(__name__)
4
 
 
30
  클로드모델_결과 = 클로드모델_처리(input_text)
31
  딥시크모델_결과 = 딥시크모델_처리(input_text)
32
 
33
+ # 결과를 HTML로 반환
34
+ return render_template_string('''
35
+ <h1>모델 처리 결과</h1>
36
+ <p><strong>일반모델:</strong> {{ 일반모델_결과 }}</p>
37
+ <p><strong>코히어모델:</strong> {{ 코히어모델_결과 }}</p>
38
+ <p><strong>지피티모델:</strong> {{ 지피티모델_결과 }}</p>
39
+ <p><strong>클로드모델:</strong> {{ 클로드모델_결과 }}</p>
40
+ <p><strong>딥시크모델:</strong> {{ 딥시크모델_결과 }}</p>
41
+ <a href="/">다시 입력하기</a>
42
+ ''',
43
+ 일반모델_결과=일반모델_결과,
44
+ 코히어모델_결과=코히어모델_결과,
45
+ 지피티모델_결과=지피티모델_결과,
46
+ 클로드모델_결과=클로드모델_결과,
47
+ 딥시크모델_결과=딥시크모델_결과)
48
 
49
  return '''
50
  <!DOCTYPE html>
 
55
  </head>
56
  <body>
57
  <h1>참조글을 입력하세요</h1>
58
+ <form method="post">
59
  <label>
60
  <strong>참조글:</strong><br>
61
  <textarea name="reference_text" rows="10" cols="50"></textarea>
 
67
  </html>
68
  '''
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  if __name__ == '__main__':
71
+ app.run(debug=True)