Spaces:
Running
Running
Addition language selection feature
Browse files
app.py
CHANGED
|
@@ -32,6 +32,9 @@ with st.sidebar:
|
|
| 32 |
# Dropdown for Tone/Style
|
| 33 |
tone_style = st.selectbox("Select Tone/Style:", ["Formal", "Informal", "Humorous", "Technical"])
|
| 34 |
|
|
|
|
|
|
|
|
|
|
| 35 |
# Sliders for Text Length and Creativity
|
| 36 |
text_length = st.slider("Text Length (words):", min_value=50, max_value=1000, step=50)
|
| 37 |
creativity_level = st.slider("Creativity Level:", min_value=0.0, max_value=1.0, step=0.1)
|
|
@@ -51,7 +54,12 @@ if creative_mode:
|
|
| 51 |
user_prompt += " Optimize the creativity of your response."
|
| 52 |
if fact_checking:
|
| 53 |
user_prompt += " Support your answer with evidence."
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Submit Button
|
| 56 |
if st.button("Generate"):
|
| 57 |
if user_prompt.strip() == "":
|
|
|
|
| 32 |
# Dropdown for Tone/Style
|
| 33 |
tone_style = st.selectbox("Select Tone/Style:", ["Formal", "Informal", "Humorous", "Technical"])
|
| 34 |
|
| 35 |
+
# Add language selection
|
| 36 |
+
language = st.selectbox("Select Language:", ["English", "Tagalog"])
|
| 37 |
+
|
| 38 |
# Sliders for Text Length and Creativity
|
| 39 |
text_length = st.slider("Text Length (words):", min_value=50, max_value=1000, step=50)
|
| 40 |
creativity_level = st.slider("Creativity Level:", min_value=0.0, max_value=1.0, step=0.1)
|
|
|
|
| 54 |
user_prompt += " Optimize the creativity of your response."
|
| 55 |
if fact_checking:
|
| 56 |
user_prompt += " Support your answer with evidence."
|
| 57 |
+
# Modify prompt based on language selection
|
| 58 |
+
if language != "English":
|
| 59 |
+
user_prompt = f"Write in {language}: {user_prompt}"
|
| 60 |
+
if language != "Tagalog":
|
| 61 |
+
user_prompt = f"Sumulat sa {language}: {user_prompt}"
|
| 62 |
+
|
| 63 |
# Submit Button
|
| 64 |
if st.button("Generate"):
|
| 65 |
if user_prompt.strip() == "":
|