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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[codz]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
share/python-wheels/
|
| 24 |
+
*.egg-info/
|
| 25 |
+
.installed.cfg
|
| 26 |
+
*.egg
|
| 27 |
+
MANIFEST
|
| 28 |
+
|
| 29 |
+
# PyInstaller
|
| 30 |
+
# Usually these files are written by a python script from a template
|
| 31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 32 |
+
*.manifest
|
| 33 |
+
*.spec
|
| 34 |
+
|
| 35 |
+
# Installer logs
|
| 36 |
+
pip-log.txt
|
| 37 |
+
pip-delete-this-directory.txt
|
| 38 |
+
|
| 39 |
+
# Unit test / coverage reports
|
| 40 |
+
htmlcov/
|
| 41 |
+
.tox/
|
| 42 |
+
.nox/
|
| 43 |
+
.coverage
|
| 44 |
+
.coverage.*
|
| 45 |
+
.cache
|
| 46 |
+
nosetests.xml
|
| 47 |
+
coverage.xml
|
| 48 |
+
*.cover
|
| 49 |
+
*.py.cover
|
| 50 |
+
.hypothesis/
|
| 51 |
+
.pytest_cache/
|
| 52 |
+
cover/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
.pybuilder/
|
| 76 |
+
target/
|
| 77 |
+
|
| 78 |
+
# Jupyter Notebook
|
| 79 |
+
.ipynb_checkpoints
|
| 80 |
+
|
| 81 |
+
# IPython
|
| 82 |
+
profile_default/
|
| 83 |
+
ipython_config.py
|
| 84 |
+
|
| 85 |
+
# pem
|
| 86 |
+
*.pem
|
| 87 |
+
|
| 88 |
+
# pyenv
|
| 89 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 90 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 91 |
+
# .python-version
|
| 92 |
+
|
| 93 |
+
# pipenv
|
| 94 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 95 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 96 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 97 |
+
# install all needed dependencies.
|
| 98 |
+
#Pipfile.lock
|
| 99 |
+
|
| 100 |
+
# UV
|
| 101 |
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
| 102 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 103 |
+
# commonly ignored for libraries.
|
| 104 |
+
#uv.lock
|
| 105 |
+
|
| 106 |
+
# poetry
|
| 107 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 108 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 109 |
+
# commonly ignored for libraries.
|
| 110 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 111 |
+
#poetry.lock
|
| 112 |
+
#poetry.toml
|
| 113 |
+
|
| 114 |
+
# pdm
|
| 115 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 116 |
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
| 117 |
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
| 118 |
+
#pdm.lock
|
| 119 |
+
#pdm.toml
|
| 120 |
+
.pdm-python
|
| 121 |
+
.pdm-build/
|
| 122 |
+
|
| 123 |
+
# pixi
|
| 124 |
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
| 125 |
+
#pixi.lock
|
| 126 |
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
| 127 |
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
| 128 |
+
.pixi
|
| 129 |
+
|
| 130 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 131 |
+
__pypackages__/
|
| 132 |
+
|
| 133 |
+
# Celery stuff
|
| 134 |
+
celerybeat-schedule
|
| 135 |
+
celerybeat.pid
|
| 136 |
+
|
| 137 |
+
# SageMath parsed files
|
| 138 |
+
*.sage.py
|
| 139 |
+
|
| 140 |
+
# Environments
|
| 141 |
+
.env
|
| 142 |
+
.envrc
|
| 143 |
+
.venv
|
| 144 |
+
env/
|
| 145 |
+
venv/
|
| 146 |
+
ENV/
|
| 147 |
+
env.bak/
|
| 148 |
+
venv.bak/
|
| 149 |
+
|
| 150 |
+
# Spyder project settings
|
| 151 |
+
.spyderproject
|
| 152 |
+
.spyproject
|
| 153 |
+
|
| 154 |
+
# Rope project settings
|
| 155 |
+
.ropeproject
|
| 156 |
+
|
| 157 |
+
# mkdocs documentation
|
| 158 |
+
/site
|
| 159 |
+
|
| 160 |
+
# mypy
|
| 161 |
+
.mypy_cache/
|
| 162 |
+
.dmypy.json
|
| 163 |
+
dmypy.json
|
| 164 |
+
|
| 165 |
+
# Pyre type checker
|
| 166 |
+
.pyre/
|
| 167 |
+
|
| 168 |
+
# pytype static type analyzer
|
| 169 |
+
.pytype/
|
| 170 |
+
|
| 171 |
+
# Cython debug symbols
|
| 172 |
+
cython_debug/
|
| 173 |
+
|
| 174 |
+
# PyCharm
|
| 175 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 176 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 177 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 178 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 179 |
+
#.idea/
|
| 180 |
+
|
| 181 |
+
# Abstra
|
| 182 |
+
# Abstra is an AI-powered process automation framework.
|
| 183 |
+
# Ignore directories containing user credentials, local state, and settings.
|
| 184 |
+
# Learn more at https://abstra.io/docs
|
| 185 |
+
.abstra/
|
| 186 |
+
|
| 187 |
+
# Visual Studio Code
|
| 188 |
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
| 189 |
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
| 190 |
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
| 191 |
+
# you could uncomment the following to ignore the entire vscode folder
|
| 192 |
+
# .vscode/
|
| 193 |
+
|
| 194 |
+
# Ruff stuff:
|
| 195 |
+
.ruff_cache/
|
| 196 |
+
|
| 197 |
+
# PyPI configuration file
|
| 198 |
+
.pypirc
|
| 199 |
+
|
| 200 |
+
# Cursor
|
| 201 |
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
| 202 |
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
| 203 |
+
# refer to https://docs.cursor.com/context/ignore-files
|
| 204 |
+
.cursorignore
|
| 205 |
+
.cursorindexingignore
|
| 206 |
+
|
| 207 |
+
# Marimo
|
| 208 |
+
marimo/_static/
|
| 209 |
+
marimo/_lsp/
|
| 210 |
+
__marimo__/
|
README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
| 1 |
-
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
pinned: false
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: clt805
|
| 3 |
+
app_file: app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 6.8.0
|
| 6 |
+
---
|
| 7 |
+
# hkey
|
| 8 |
+
base
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import asyncio
|
| 3 |
+
import os
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import tempfile
|
| 6 |
+
from openai import AsyncOpenAI
|
| 7 |
+
from dotenv import load_dotenv
|
| 8 |
+
|
| 9 |
+
load_dotenv()
|
| 10 |
+
|
| 11 |
+
OPENROUTER_API_KEY = os.getenv("openrouter_api_key")
|
| 12 |
+
|
| 13 |
+
client = AsyncOpenAI(
|
| 14 |
+
base_url="https://openrouter.ai/api/v1",
|
| 15 |
+
api_key=OPENROUTER_API_KEY,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
MODELS = {
|
| 19 |
+
"OpenAI (GPT 5.2)": "openai/gpt-5.2",
|
| 20 |
+
"Anthropic (Claude 4.6 Sonnet)": "anthropic/claude-sonnet-4.6",
|
| 21 |
+
"Google (Gemini 3.1 Pro)": "google/gemini-3.1-pro-preview",
|
| 22 |
+
"DeepSeek (DeepSeek 3.2)": "deepseek/deepseek-v3.2"
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
async def fetch_response(model_id, prompt):
|
| 26 |
+
try:
|
| 27 |
+
response = await client.chat.completions.create(
|
| 28 |
+
model=model_id,
|
| 29 |
+
messages=[{"role": "user", "content": prompt}],
|
| 30 |
+
temperature=0.7 # ํ์์ ๋ฐ๋ผ ์กฐ์
|
| 31 |
+
)
|
| 32 |
+
return response.choices[0].message.content
|
| 33 |
+
except Exception as e:
|
| 34 |
+
return f"โ ๏ธ ์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 35 |
+
|
| 36 |
+
async def generate_all(prompt):
|
| 37 |
+
tasks = [fetch_response(model_id, prompt) for model_id in MODELS.values()]
|
| 38 |
+
results = await asyncio.gather(*tasks)
|
| 39 |
+
return results
|
| 40 |
+
|
| 41 |
+
def export_to_excel(prompt, res1, res2, res3, res4):
|
| 42 |
+
data = {
|
| 43 |
+
"๊ตฌ๋ถ": ["์ฌ์ฉ์ ํ๋กฌํํธ"] + list(MODELS.keys()),
|
| 44 |
+
"๋ด์ฉ": [prompt, res1, res2, res3, res4]
|
| 45 |
+
}
|
| 46 |
+
df = pd.DataFrame(data)
|
| 47 |
+
|
| 48 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".xlsx")
|
| 49 |
+
df.to_excel(temp_file.name, index=False, engine='openpyxl')
|
| 50 |
+
|
| 51 |
+
return temp_file.name
|
| 52 |
+
|
| 53 |
+
with gr.Blocks(title="ํ๋ฌธ๊ณ ์ ๋ฒ์ญํน์๊ณผ์ ์ฐ๊ตฌ") as demo:
|
| 54 |
+
gr.Markdown("# ํ๋ฌธ ๊ณ ์ ๋ฒ์ญ ํน์๊ณผ์ ์ฐ๊ตฌ1")
|
| 55 |
+
gr.Markdown("์ค๋ฅ ๋ฐ์ ์ 1041489@gmail.com ์ผ๋ก ๋ฌธ์์ฃผ์ธ์.")
|
| 56 |
+
|
| 57 |
+
with gr.Row():
|
| 58 |
+
user_input = gr.Textbox(
|
| 59 |
+
label="ํ๋กฌํํธ ์
๋ ฅ",
|
| 60 |
+
lines=5,
|
| 61 |
+
placeholder="๋ชจ๋ธ๋ค์๊ฒ ๋ฌผ์ด๋ณผ ์ง๋ฌธ์ด๋ ์ง์์ฌํญ์ ์
๋ ฅํ์ธ์..."
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
with gr.Row():
|
| 65 |
+
submit_btn = gr.Button("๊ฒฐ๊ณผ๋ฌผ ์์ฑ", variant="primary")
|
| 66 |
+
excel_btn = gr.Button("์์
๋ก ๋ด๋ณด๋ด๊ธฐ", variant="secondary")
|
| 67 |
+
|
| 68 |
+
excel_download = gr.File(label="๋ค์ด๋ก๋ํ ์์
ํ์ผ", visible=False)
|
| 69 |
+
|
| 70 |
+
gr.Markdown("### ๋ชจ๋ธ๋ณ ์ถ๋ ฅ ๊ฒฐ๊ณผ")
|
| 71 |
+
|
| 72 |
+
outputs = []
|
| 73 |
+
with gr.Row():
|
| 74 |
+
for model_name in list(MODELS.keys())[:2]:
|
| 75 |
+
outputs.append(gr.Textbox(label=model_name, lines=15, interactive=False))
|
| 76 |
+
with gr.Row():
|
| 77 |
+
for model_name in list(MODELS.keys())[2:]:
|
| 78 |
+
outputs.append(gr.Textbox(label=model_name, lines=15, interactive=False))
|
| 79 |
+
|
| 80 |
+
submit_btn.click(
|
| 81 |
+
fn=generate_all,
|
| 82 |
+
inputs=user_input,
|
| 83 |
+
outputs=outputs
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
excel_btn.click(
|
| 87 |
+
fn=export_to_excel,
|
| 88 |
+
inputs=[user_input] + outputs,
|
| 89 |
+
outputs=excel_download
|
| 90 |
+
).then(
|
| 91 |
+
fn=lambda: gr.update(visible=True),
|
| 92 |
+
outputs=excel_download
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
if __name__ == "__main__":
|
| 96 |
+
demo.launch(share=True, theme=gr.themes.Soft())
|