Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,11 +54,16 @@ def get_homeopathic_advice(symptoms):
|
|
54 |
def translate_text(text, target_lang):
|
55 |
"""Translate text using Groq's LLaMA model."""
|
56 |
try:
|
|
|
|
|
|
|
|
|
|
|
57 |
response = groq_client.chat.completions.create(
|
58 |
model="llama3-70b-8192",
|
59 |
messages=[
|
60 |
{"role": "system", "content": "You are a multilingual AI that accurately translates medical advice while preserving technical accuracy."},
|
61 |
-
{"role": "user", "content":
|
62 |
],
|
63 |
temperature=0.2
|
64 |
)
|
@@ -68,7 +73,7 @@ def translate_text(text, target_lang):
|
|
68 |
|
69 |
# 🎨 Streamlit UI
|
70 |
st.set_page_config(page_title="Homeo Doctor AI", page_icon="🌿")
|
71 |
-
st.title("🌍 AI-Powered Homeopathic Doctor
|
72 |
|
73 |
# Chat interface
|
74 |
if "messages" not in st.session_state:
|
@@ -101,7 +106,7 @@ if prompt := st.chat_input("Describe your symptoms..."):
|
|
101 |
**💡 Expert Homeopathic Advice (English):**
|
102 |
{homeo_advice}
|
103 |
|
104 |
-
**🌍 Translated Advice ({detected_lang.upper()}):**
|
105 |
{translated_advice}
|
106 |
"""
|
107 |
|
|
|
54 |
def translate_text(text, target_lang):
|
55 |
"""Translate text using Groq's LLaMA model."""
|
56 |
try:
|
57 |
+
if target_lang == "roman_ur":
|
58 |
+
translation_prompt = f"Translate this medical advice into **Roman Urdu**, keeping it in **Latin script**: {text}"
|
59 |
+
else:
|
60 |
+
translation_prompt = f"Translate this medical advice into {target_lang}: {text}"
|
61 |
+
|
62 |
response = groq_client.chat.completions.create(
|
63 |
model="llama3-70b-8192",
|
64 |
messages=[
|
65 |
{"role": "system", "content": "You are a multilingual AI that accurately translates medical advice while preserving technical accuracy."},
|
66 |
+
{"role": "user", "content": translation_prompt}
|
67 |
],
|
68 |
temperature=0.2
|
69 |
)
|
|
|
73 |
|
74 |
# 🎨 Streamlit UI
|
75 |
st.set_page_config(page_title="Homeo Doctor AI", page_icon="🌿")
|
76 |
+
st.title("🌍 AI-Powered Homeopathic Doctor")
|
77 |
|
78 |
# Chat interface
|
79 |
if "messages" not in st.session_state:
|
|
|
106 |
**💡 Expert Homeopathic Advice (English):**
|
107 |
{homeo_advice}
|
108 |
|
109 |
+
**🌍 Translated Advice ({'Roman Urdu' if detected_lang == 'roman_ur' else detected_lang.upper()}):**
|
110 |
{translated_advice}
|
111 |
"""
|
112 |
|