Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def main():
|
|
118 |
""", unsafe_allow_html=True
|
119 |
)
|
120 |
|
121 |
-
st.title("
|
122 |
|
123 |
# Sidebar for temperature and token adjustment
|
124 |
st.sidebar.header("Settings")
|
@@ -133,31 +133,37 @@ def main():
|
|
133 |
# Input box for user
|
134 |
tamil_input = st.text_input("Enter Tamil text (or select a suggestion):", selected_suggestion)
|
135 |
|
|
|
|
|
|
|
136 |
if st.button("Generate"):
|
137 |
# Step 1: Translation (Tamil to English)
|
138 |
if tamil_input:
|
139 |
st.write("### Translated English Text:")
|
140 |
english_text = translate_text(tamil_input)
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
161 |
|
162 |
if __name__ == "__main__":
|
163 |
main()
|
|
|
118 |
""", unsafe_allow_html=True
|
119 |
)
|
120 |
|
121 |
+
st.title("🅰️ℹ️ Multimodal Generator")
|
122 |
|
123 |
# Sidebar for temperature and token adjustment
|
124 |
st.sidebar.header("Settings")
|
|
|
133 |
# Input box for user
|
134 |
tamil_input = st.text_input("Enter Tamil text (or select a suggestion):", selected_suggestion)
|
135 |
|
136 |
+
# Initialize a variable to store the English text
|
137 |
+
english_text = None
|
138 |
+
|
139 |
if st.button("Generate"):
|
140 |
# Step 1: Translation (Tamil to English)
|
141 |
if tamil_input:
|
142 |
st.write("### Translated English Text:")
|
143 |
english_text = translate_text(tamil_input)
|
144 |
+
|
145 |
+
# If translation fails, ask for English input
|
146 |
+
if not english_text:
|
147 |
+
english_text = st.text_input("Translation failed. Please enter English text instead:")
|
148 |
+
|
149 |
+
# Ensure the English text is available
|
150 |
+
if english_text:
|
151 |
+
st.success(english_text)
|
152 |
+
|
153 |
+
# Step 2: Generate Educational Content
|
154 |
+
st.write("### Generated Educational Content:")
|
155 |
+
with st.spinner('Generating content...'):
|
156 |
+
content_output = generate_content(english_text, max_tokens, temperature)
|
157 |
+
if content_output:
|
158 |
+
st.success(content_output)
|
159 |
+
|
160 |
+
# Step 3: Generate Image from the prompt
|
161 |
+
st.write("### Generated Image:")
|
162 |
+
with st.spinner('Generating image...'):
|
163 |
+
image_prompt = generate_image_prompt(english_text)
|
164 |
+
image_data = generate_image(image_prompt)
|
165 |
+
if image_data:
|
166 |
+
st.image(image_data, caption="Generated Image")
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
main()
|