Spaces:
Runtime error
Runtime error
import streamlit as st | |
from pykakasi import kakasi | |
def to_romaji(text): | |
kakasi_instance = kakasi() | |
result = kakasi_instance.convert(text) | |
result_str = "" | |
for item in result: | |
result_str += item['hepburn'] + " " | |
# print("{}: kana '{}', hiragana '{}', romaji: '{}'".format(item['orig'], item['kana'], item['hira'], item['hepburn'])) | |
return result_str | |
st.title('日文转罗马音') | |
text = st.text_area('在这里输入日文:') | |
if text: | |
romaji = to_romaji(text) | |
st.write('罗马音:') | |
st.write(romaji) | |