Commit ·
ae7c243
1
Parent(s): 7338704
Attempting double tabbed interface, one tab for each language
Browse files
app.py
CHANGED
|
@@ -1,31 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from polish import polish_sentence_to_latin
|
|
|
|
| 3 |
|
| 4 |
-
st.
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
example3 = "Jarosław, Przemyśl"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
input_string = 'Jarosław, Przemyśl'
|
| 21 |
-
else:
|
| 22 |
-
input_string = input_string
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import streamlit as st
|
| 2 |
+
# from polish import polish_sentence_to_latin
|
| 3 |
+
|
| 4 |
+
# st.title("Language Transliteration Interface")
|
| 5 |
+
|
| 6 |
+
# input_string = st.text_input("Enter a Polish word/sentence to transliterate :")
|
| 7 |
+
|
| 8 |
+
# example1 = "Dziękuję bardzo!" # Example 1
|
| 9 |
+
# example2 = "Wszystkiego najlepszego!" # Example 2
|
| 10 |
+
# example3 = "Jarosław, Przemyśl"
|
| 11 |
+
|
| 12 |
+
# selected_example = st.selectbox('Choose an example as demo',
|
| 13 |
+
# ('None','Dziękuję bardzo!', 'Wszystkiego najlepszego!', 'Jarosław, Przemyśl'))
|
| 14 |
+
|
| 15 |
+
# if selected_example == 'Dziękuję bardzo!':
|
| 16 |
+
# input_string = 'Dziękuję bardzo!'
|
| 17 |
+
# elif selected_example == 'Wszystkiego najlepszego!':
|
| 18 |
+
# input_string = 'Wszystkiego najlepszego!'
|
| 19 |
+
# elif selected_example == 'Jarosław, Przemyśl':
|
| 20 |
+
# input_string = 'Jarosław, Przemyśl'
|
| 21 |
+
# else:
|
| 22 |
+
# input_string = input_string
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# if st.button("Transliterate"):
|
| 26 |
+
# if input_string:
|
| 27 |
+
# output_string = polish_sentence_to_latin(input_string)
|
| 28 |
+
# st.subheader("Transliterated Output:")
|
| 29 |
+
# st.write(output_string)
|
| 30 |
+
# else:
|
| 31 |
+
# st.warning("Please enter a string.")
|
| 32 |
+
|
| 33 |
import streamlit as st
|
| 34 |
from polish import polish_sentence_to_latin
|
| 35 |
+
from hungarian import hungarian_sentence_to_latin
|
| 36 |
|
| 37 |
+
tab1, tab2= st.tabs(["Polish", "Hungarian"])
|
| 38 |
|
| 39 |
+
with tab1:
|
| 40 |
+
st.header("Polish Transliteration")
|
| 41 |
+
input_string = st.text_input("Enter a Polish word/sentence to transliterate:")
|
| 42 |
+
polish_examples = ['Dziękuję bardzo!', 'Wszystkiego najlepszego!', 'Jarosław, Przemyśl']
|
| 43 |
+
selected_example = st.selectbox('Choose an example as demo', ['None'] + polish_examples)
|
| 44 |
|
| 45 |
+
if selected_example != 'None':
|
| 46 |
+
input_string = selected_example
|
|
|
|
| 47 |
|
| 48 |
+
if st.button("Transliterate"):
|
| 49 |
+
if input_string:
|
| 50 |
+
output_string = polish_sentence_to_latin(input_string)
|
| 51 |
+
st.subheader("Transliterated Output:")
|
| 52 |
+
st.write(output_string)
|
| 53 |
+
else:
|
| 54 |
+
st.warning("Please enter a string.")
|
| 55 |
|
| 56 |
+
with tab2:
|
| 57 |
+
st.header("Hungarian Transliteration")
|
| 58 |
+
input_string = st.text_input("Enter a Hungarian word/sentence to transliterate:")
|
| 59 |
+
hungarian_examples = ['Köszönöm szépen!', 'Budapest, Magyarország']
|
| 60 |
+
selected_example = st.selectbox('Choose an example as demo', ['None'] + hungarian_examples)
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
if selected_example != 'None':
|
| 63 |
+
input_string = selected_example
|
| 64 |
+
|
| 65 |
+
if st.button("Transliterate"):
|
| 66 |
+
if input_string:
|
| 67 |
+
output_string = hungarian_sentence_to_latin(input_string)
|
| 68 |
+
st.subheader("Transliterated Output:")
|
| 69 |
+
st.write(output_string)
|
| 70 |
+
else:
|
| 71 |
+
st.warning("Please enter a string.")
|
| 72 |
+
|
| 73 |
+
|