Update app.py
Browse files
app.py
CHANGED
@@ -144,6 +144,7 @@ def text_to_parquet(text: str) -> Tuple[str, str, str]:
|
|
144 |
print(error_message)
|
145 |
return error_message, "", ""
|
146 |
|
|
|
147 |
def preprocess_text_with_llm(input_text: str) -> str:
|
148 |
if not input_text.strip():
|
149 |
return "์
๋ ฅ ํ
์คํธ๊ฐ ๋น์ด์์ต๋๋ค."
|
@@ -162,32 +163,23 @@ def preprocess_text_with_llm(input_text: str) -> str:
|
|
162 |
- ํฐ๋ฐ์ดํ๋ ๋ฐฑ์ฌ๋์๋ก ์ด์ค์ผ์ดํ ์ฒ๋ฆฌ
|
163 |
- ๊ฐ ํ์ ์๋ก์ด ์ค๋ก ๊ตฌ๋ถ
|
164 |
- ๋ชจ๋ ํ๋๋ ์ผํ๋ก ๊ตฌ๋ถ
|
165 |
-
|
166 |
-
์
๋ ฅ ํ
์คํธ:
|
167 |
"""
|
168 |
|
169 |
-
full_prompt = f"{system_prompt}\n\n{input_text}\n\n์ถ๋ ฅ:"
|
170 |
-
|
171 |
try:
|
172 |
-
response =
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
temperature=0.3, # ๋ ๊ฒฐ์ ์ ์ธ ์ถ๋ ฅ์ ์ํด ๋ฎ์ถค
|
177 |
top_p=0.9,
|
178 |
-
stream=
|
179 |
)
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
response += msg
|
184 |
-
|
185 |
-
# ์๋ต ์ ์
|
186 |
-
processed_text = response.strip()
|
187 |
|
188 |
# CSV ํ์ ๊ฒ์ฆ
|
189 |
try:
|
190 |
-
# StringIO๋ฅผ ์ฌ์ฉํ์ฌ CSV ํ์ ๊ฒ์ฆ
|
191 |
from io import StringIO
|
192 |
import csv
|
193 |
csv.reader(StringIO(processed_text))
|
@@ -200,6 +192,7 @@ def preprocess_text_with_llm(input_text: str) -> str:
|
|
200 |
print(error_message)
|
201 |
return error_message
|
202 |
|
|
|
203 |
# CSS ์ค์
|
204 |
css = """
|
205 |
footer {
|
|
|
144 |
print(error_message)
|
145 |
return error_message, "", ""
|
146 |
|
147 |
+
|
148 |
def preprocess_text_with_llm(input_text: str) -> str:
|
149 |
if not input_text.strip():
|
150 |
return "์
๋ ฅ ํ
์คํธ๊ฐ ๋น์ด์์ต๋๋ค."
|
|
|
163 |
- ํฐ๋ฐ์ดํ๋ ๋ฐฑ์ฌ๋์๋ก ์ด์ค์ผ์ดํ ์ฒ๋ฆฌ
|
164 |
- ๊ฐ ํ์ ์๋ก์ด ์ค๋ก ๊ตฌ๋ถ
|
165 |
- ๋ชจ๋ ํ๋๋ ์ผํ๋ก ๊ตฌ๋ถ
|
166 |
+
- <EOS_TOKEN>์ด๋ ๋ถํ์ํ ํ
์คํธ๋ ์ ๊ฑฐ
|
|
|
167 |
"""
|
168 |
|
|
|
|
|
169 |
try:
|
170 |
+
response = hf_client.text_generation(
|
171 |
+
prompt=f"{system_prompt}\n\n{input_text}\n\n์ถ๋ ฅ:",
|
172 |
+
max_new_tokens=4000,
|
173 |
+
temperature=0.3,
|
|
|
174 |
top_p=0.9,
|
175 |
+
stream=False
|
176 |
)
|
177 |
|
178 |
+
# ์๋ต์์ <EOS_TOKEN> ์ด์ ๊น์ง๋ง ์ถ์ถ
|
179 |
+
processed_text = response.split("<EOS_TOKEN>")[0].strip()
|
|
|
|
|
|
|
|
|
180 |
|
181 |
# CSV ํ์ ๊ฒ์ฆ
|
182 |
try:
|
|
|
183 |
from io import StringIO
|
184 |
import csv
|
185 |
csv.reader(StringIO(processed_text))
|
|
|
192 |
print(error_message)
|
193 |
return error_message
|
194 |
|
195 |
+
|
196 |
# CSS ์ค์
|
197 |
css = """
|
198 |
footer {
|