Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -203,7 +203,7 @@ if uploaded_file:
|
|
203 |
- Side Effects: ...
|
204 |
- Special Instructions: ...
|
205 |
|
206 |
-
Ensure each medicine starts with a new bullet point and all details are on separate lines.
|
207 |
"""
|
208 |
|
209 |
prompt = PromptTemplate(input_variables=["prescription_text"], template=template)
|
@@ -263,10 +263,21 @@ if uploaded_file:
|
|
263 |
|
264 |
if filtered_output and st.button("π Translate to Hindi"):
|
265 |
with st.spinner("Translating to Hindi..."):
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
st.markdown("#### π Hindi Translation")
|
272 |
st.text_area("Translated Output (Hindi)", hindi_text, height=300)
|
|
|
203 |
- Side Effects: ...
|
204 |
- Special Instructions: ...
|
205 |
|
206 |
+
Ensure each medicine starts with a new bullet point and all details are on separate lines and don't bold any bullet point.
|
207 |
"""
|
208 |
|
209 |
prompt = PromptTemplate(input_variables=["prescription_text"], template=template)
|
|
|
263 |
|
264 |
if filtered_output and st.button("π Translate to Hindi"):
|
265 |
with st.spinner("Translating to Hindi..."):
|
266 |
+
hindi_text = GoogleTranslator(source='auto', target='hi').translate(filtered_output)
|
267 |
+
|
268 |
+
|
269 |
+
# API_URL = "https://api-inference.huggingface.co/models/facebook/mbart-large-50-many-to-many-mmt"
|
270 |
+
# headers = {"Authorization": f"Bearer YOUR_HF_TOKEN"}
|
271 |
+
|
272 |
+
# def translate_hi_to_fr(text):
|
273 |
+
# payload = {
|
274 |
+
# "inputs": f"hi_IN {text}", # manually prepending language code
|
275 |
+
# "parameters": {
|
276 |
+
# "forced_bos_token_id": 250012 # French
|
277 |
+
# }
|
278 |
+
# }
|
279 |
+
# response = requests.post(API_URL, headers=headers, json=payload)
|
280 |
+
# return response.json()
|
281 |
|
282 |
st.markdown("#### π Hindi Translation")
|
283 |
st.text_area("Translated Output (Hindi)", hindi_text, height=300)
|