Add Slider and estimated cost to Auto-Translate
Browse files
app.py
CHANGED
@@ -156,7 +156,14 @@ with tab3:
|
|
156 |
|
157 |
# User input for OpenAI API key
|
158 |
openai_api_key = st.text_input("Paste your OpenAI API key:")
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
if st.button("Auto-Translate 10 Samples"):
|
161 |
if openai_api_key:
|
162 |
openai.api_key = openai_api_key
|
|
|
156 |
|
157 |
# User input for OpenAI API key
|
158 |
openai_api_key = st.text_input("Paste your OpenAI API key:")
|
159 |
+
|
160 |
+
# Slider for the user to choose the number of samples to translate
|
161 |
+
num_samples = st.slider("Select the number of samples to translate", min_value=1, max_value=100, value=10)
|
162 |
+
|
163 |
+
# Estimated cost display
|
164 |
+
cost = num_samples * 0.0012
|
165 |
+
st.write(f"The estimated cost for translating {num_samples} samples is: ${cost:.4f}")
|
166 |
+
|
167 |
if st.button("Auto-Translate 10 Samples"):
|
168 |
if openai_api_key:
|
169 |
openai.api_key = openai_api_key
|