Spaces:
Runtime error
Runtime error
| from flask import Flask, request, render_template_string | |
| app = Flask(__name__) | |
| # 각 모델에 대한 처리 함수 (가상) | |
| def 일반모델_처리(text): | |
| return f"일반모델 처리 결과: {text}" | |
| def 코히어모델_처리(text): | |
| return f"코히어모델 처리 결과: {text}" | |
| def 지피티모델_처리(text): | |
| return f"지피티모델 처리 결과: {text}" | |
| def 클로드모델_처리(text): | |
| return f"클로드모델 처리 결과: {text}" | |
| def 딥시크모델_처리(text): | |
| return f"딥시크모델 처리 결과: {text}" | |
| def index(): | |
| if request.method == 'POST': | |
| input_text = request.form['reference_text'] | |
| # 모든 모델에 대해 처리 | |
| 일반모델_결과 = 일반모델_처리(input_text) | |
| 코히어모델_결과 = 코히어모델_처리(input_text) | |
| 지피티모델_결과 = 지피티모델_처리(input_text) | |
| 클로드모델_결과 = 클로드모델_처리(input_text) | |
| 딥시크모델_결과 = 딥시크모델_처리(input_text) | |
| # 결과를 HTML로 반환 | |
| return render_template_string(''' | |
| <h1>모델 처리 결과</h1> | |
| <p><strong>일반모델:</strong> {{ 일반모델_결과 }}</p> | |
| <p><strong>코히어모델:</strong> {{ 코히어모델_결과 }}</p> | |
| <p><strong>지피티모델:</strong> {{ 지피티모델_결과 }}</p> | |
| <p><strong>클로드모델:</strong> {{ 클로드모델_결과 }}</p> | |
| <p><strong>딥시크모델:</strong> {{ 딥시크모델_결과 }}</p> | |
| <a href="/">다시 입력하기</a> | |
| ''', | |
| 일반모델_결과=일반모델_결과, | |
| 코히어모델_결과=코히어모델_결과, | |
| 지피티모델_결과=지피티모델_결과, | |
| 클로드모델_결과=클로드모델_결과, | |
| 딥시크모델_결과=딥시크모델_결과) | |
| return ''' | |
| <!DOCTYPE html> | |
| <html lang="ko"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>블로그 생성기</title> | |
| </head> | |
| <body> | |
| <h1>참조글을 입력하세요</h1> | |
| <form method="post"> | |
| <label> | |
| <strong>참조글:</strong><br> | |
| <textarea name="reference_text" rows="10" cols="50"></textarea> | |
| </label> | |
| <br> | |
| <input type="submit" value="블로그 생성"> | |
| </form> | |
| </body> | |
| </html> | |
| ''' | |
| if __name__ == '__main__': | |
| app.run(debug=True) |