Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Hugging Faceμ Helsinki-NLP Ko->Ru λ²μκΈ° μ¬μ© | |
| translator = pipeline("translation_ko_to_ru", model="Helsinki-NLP/opus-mt-ko-ru") | |
| def chat_translate(user_input): | |
| if not user_input.strip(): | |
| return "μ λ ₯μ ν΄μ£ΌμΈμ!" | |
| # λ²μ | |
| result = translator(user_input) | |
| translated_text = result[0]['translation_text'] | |
| return translated_text | |
| # κ°λ¨ν Gradio μ± μΈν°νμ΄μ€ | |
| iface = gr.ChatInterface( | |
| fn=chat_translate, | |
| chatbot_name="νκ΅μ΄->λ¬μμμ΄ λ²μ μ±λ΄", | |
| title="νκ΅μ΄ μ λ ₯μ λ¬μμμ΄ λ²μ μ±λ΄", | |
| description="νκ΅μ΄λ‘ μ§λ¬Ένλ©΄ λ¬μμμ΄λ‘ λ²μν΄λ립λλ€." | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |