TangJicheng commited on
Commit
c25592a
1 Parent(s): 94560cd

chore: init

Browse files
Files changed (2) hide show
  1. app.py +19 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from pykakasi import kakasi
3
+
4
+ def to_romaji(text):
5
+ kakasi_instance = kakasi()
6
+ result = kakasi_instance.convert(text)
7
+ result_str = ""
8
+ for item in result:
9
+ result_str += item['hepburn'] + " "
10
+ # print("{}: kana '{}', hiragana '{}', romaji: '{}'".format(item['orig'], item['kana'], item['hira'], item['hepburn']))
11
+ return result_str
12
+
13
+ st.title('日文转罗马音')
14
+ text = st.text_area('在这里输入日文:')
15
+
16
+ if text:
17
+ romaji = to_romaji(text)
18
+ st.write('罗马音:')
19
+ st.write(romaji)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pykakasi==2.2.1