Update app.py
Browse files
app.py
CHANGED
@@ -162,21 +162,26 @@ def preprocess_text_with_llm(input_text: str) -> str:
|
|
162 |
- ν
μ€νΈμ μΌνκ° μμΌλ©΄ ν°λ°μ΄νλ‘ κ°μΈκΈ°
|
163 |
- ν°λ°μ΄νλ λ°±μ¬λμλ‘ μ΄μ€μΌμ΄ν μ²λ¦¬
|
164 |
- κ° νμ μλ‘μ΄ μ€λ‘ ꡬλΆ
|
165 |
-
- λͺ¨λ νλλ μΌνλ‘ κ΅¬λΆ
|
166 |
-
|
167 |
-
""
|
168 |
|
169 |
try:
|
170 |
-
response =
|
171 |
-
|
|
|
172 |
max_new_tokens=4000,
|
173 |
temperature=0.3,
|
174 |
top_p=0.9,
|
175 |
-
stream=
|
176 |
)
|
177 |
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
180 |
|
181 |
# CSV νμ κ²μ¦
|
182 |
try:
|
@@ -188,7 +193,7 @@ def preprocess_text_with_llm(input_text: str) -> str:
|
|
188 |
return "LLMμ΄ μ¬λ°λ₯Έ CSV νμμ μμ±νμ§ λͺ»νμ΅λλ€. λ€μ μλν΄μ£ΌμΈμ."
|
189 |
|
190 |
except Exception as e:
|
191 |
-
error_message = f"μ μ²λ¦¬ μ€ μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}
|
192 |
print(error_message)
|
193 |
return error_message
|
194 |
|
|
|
162 |
- ν
μ€νΈμ μΌνκ° μμΌλ©΄ ν°λ°μ΄νλ‘ κ°μΈκΈ°
|
163 |
- ν°λ°μ΄νλ λ°±μ¬λμλ‘ μ΄μ€μΌμ΄ν μ²λ¦¬
|
164 |
- κ° νμ μλ‘μ΄ μ€λ‘ ꡬλΆ
|
165 |
+
- λͺ¨λ νλλ μΌνλ‘ κ΅¬λΆ"""
|
166 |
+
|
167 |
+
full_prompt = f"{system_prompt}\n\n{input_text}\n\nμΆλ ₯:"
|
168 |
|
169 |
try:
|
170 |
+
response = ""
|
171 |
+
stream = hf_client.text_generation(
|
172 |
+
prompt=full_prompt,
|
173 |
max_new_tokens=4000,
|
174 |
temperature=0.3,
|
175 |
top_p=0.9,
|
176 |
+
stream=True,
|
177 |
)
|
178 |
|
179 |
+
for msg in stream:
|
180 |
+
if msg:
|
181 |
+
response += msg
|
182 |
+
|
183 |
+
# μλ΅ μ μ
|
184 |
+
processed_text = response.strip()
|
185 |
|
186 |
# CSV νμ κ²μ¦
|
187 |
try:
|
|
|
193 |
return "LLMμ΄ μ¬λ°λ₯Έ CSV νμμ μμ±νμ§ λͺ»νμ΅λλ€. λ€μ μλν΄μ£ΌμΈμ."
|
194 |
|
195 |
except Exception as e:
|
196 |
+
error_message = f"μ μ²λ¦¬ μ€ μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}"
|
197 |
print(error_message)
|
198 |
return error_message
|
199 |
|