Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
2164597
1
Parent(s):
c14fede
Remove redundant hardcoded translation mapping in favor of AI translation
Browse files- Removed korean_to_english_examples dictionary as it's redundant
- All Korean prompts now rely solely on polish_prompt() AI translation
- Eliminates manual maintenance of translation mappings
- Simplified code by removing hardcoded example-specific logic
- Updated documentation to reflect AI-only translation approach
- More flexible system that handles any Korean input automatically
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
README.md
CHANGED
|
@@ -53,7 +53,7 @@ python_version: 3.11
|
|
| 53 |
- **GPU 타임아웃**: 180초(3분)로 설정하여 안정적인 처리 보장
|
| 54 |
- **에러 핸들링**: 예외 발생 시 원본 이미지 반환 및 재시도 로직 개선
|
| 55 |
- **다운로드 형식**: PNG 형식으로 설정하여 더 나은 이미지 품질 제공
|
| 56 |
-
-
|
| 57 |
|
| 58 |
#### 사용자 인터페이스 개선
|
| 59 |
- **시드 랜덤화**: 기본값으로 활성화되어 매번 다른 결과 생성, 일관된 UI/함수 동작 보장
|
|
@@ -68,7 +68,7 @@ python_version: 3.11
|
|
| 68 |
|
| 69 |
#### 다국어 지원
|
| 70 |
- **한국어-영어 하이브리드**: 한국어 UI 표시와 영어 처리의 최적 조합
|
| 71 |
-
-
|
| 72 |
- **깔끔한 예시 인터페이스**: Gradio 표준 예시 컴포넌트 활용으로 친숙하고 깔끔한 UI
|
| 73 |
- **선택적 실행**: 예시 클릭으로 필드만 채워지고 수동 실행으로 사용자 제어 강화
|
| 74 |
|
|
|
|
| 53 |
- **GPU 타임아웃**: 180초(3분)로 설정하여 안정적인 처리 보장
|
| 54 |
- **에러 핸들링**: 예외 발생 시 원본 이미지 반환 및 재시도 로직 개선
|
| 55 |
- **다운로드 형식**: PNG 형식으로 설정하여 더 나은 이미지 품질 제공
|
| 56 |
+
- **AI 프롬프트 최적화**: DashScope API를 통한 자동 프롬프트 번역 및 개선, 하드코딩된 번역 매핑 제거
|
| 57 |
|
| 58 |
#### 사용자 인터페이스 개선
|
| 59 |
- **시드 랜덤화**: 기본값으로 활성화되어 매번 다른 결과 생성, 일관된 UI/함수 동작 보장
|
|
|
|
| 68 |
|
| 69 |
#### 다국어 지원
|
| 70 |
- **한국어-영어 하이브리드**: 한국어 UI 표시와 영어 처리의 최적 조합
|
| 71 |
+
- **AI 자동 번역 시스템**: 모든 한국어 프롬프트가 DashScope API를 통해 자동으로 영어로 번역 및 최적화되어 AI 처리
|
| 72 |
- **깔끔한 예시 인터페이스**: Gradio 표준 예시 컴포넌트 활용으로 친숙하고 깔끔한 UI
|
| 73 |
- **선택적 실행**: 예시 클릭으로 필드만 채워지고 수동 실행으로 사용자 제어 강화
|
| 74 |
|
app.py
CHANGED
|
@@ -182,20 +182,7 @@ def infer(
|
|
| 182 |
# Set up the generator for reproducibility
|
| 183 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 184 |
|
| 185 |
-
#
|
| 186 |
-
korean_to_english_examples = {
|
| 187 |
-
"텍스트를 'COOL NEON SIGN HERE'으로 변경해주세요": "Change the text to 'COOL NEON SIGN HERE'",
|
| 188 |
-
"고양이가 전통 조선시대 검은 말총 갓만 쓰고 다른 옷은 입지 않은 모습으로 만들어 주세요": "Please make the cat wear only a traditional Joseon-era black horsehair gat and no other clothing",
|
| 189 |
-
"사진 스타일을 빈티지 만화책 스타일로 바꿔주세요": "Change the photo style to vintage comic book"
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
# Convert Korean example to English for processing
|
| 193 |
-
# Handle bilingual prompts by extracting Korean part
|
| 194 |
-
korean_part = prompt.split(' → ')[0] if ' → ' in prompt else prompt
|
| 195 |
-
if korean_part in korean_to_english_examples:
|
| 196 |
-
original_prompt = prompt
|
| 197 |
-
prompt = korean_to_english_examples[korean_part]
|
| 198 |
-
print(f"Translating Korean example: '{original_prompt}' -> '{prompt}'")
|
| 199 |
|
| 200 |
print(f"Calling pipeline with prompt: '{prompt}'")
|
| 201 |
print(f"Negative Prompt: '{negative_prompt}'")
|
|
|
|
| 182 |
# Set up the generator for reproducibility
|
| 183 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 184 |
|
| 185 |
+
# Korean prompts will be automatically translated via polish_prompt() function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
print(f"Calling pipeline with prompt: '{prompt}'")
|
| 188 |
print(f"Negative Prompt: '{negative_prompt}'")
|