Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -253,7 +253,7 @@ pipe = TextGenerationPipeline(
|
|
253 |
)
|
254 |
|
255 |
# Prompt formatter based on language
|
256 |
-
def generate_prompt(message
|
257 |
lang = detect(message)
|
258 |
if lang == "ar":
|
259 |
return f"""أجب على السؤال الطبي التالي بلغة عربية فصحى، بإجابة دقيقة ومفصلة. إذا لم تجد معلومات كافية في السياق، استخدم معرفتك الطبية السابقة.
|
@@ -270,8 +270,8 @@ Answer:"""
|
|
270 |
|
271 |
# Chat function
|
272 |
@app.post("/ask")
|
273 |
-
def chat_fn(message
|
274 |
-
prompt = generate_prompt(message
|
275 |
response = pipe(prompt,
|
276 |
max_new_tokens=512,
|
277 |
temperature=0.7,
|
|
|
253 |
)
|
254 |
|
255 |
# Prompt formatter based on language
|
256 |
+
def generate_prompt(message):
|
257 |
lang = detect(message)
|
258 |
if lang == "ar":
|
259 |
return f"""أجب على السؤال الطبي التالي بلغة عربية فصحى، بإجابة دقيقة ومفصلة. إذا لم تجد معلومات كافية في السياق، استخدم معرفتك الطبية السابقة.
|
|
|
270 |
|
271 |
# Chat function
|
272 |
@app.post("/ask")
|
273 |
+
def chat_fn(message):
|
274 |
+
prompt = generate_prompt(message)
|
275 |
response = pipe(prompt,
|
276 |
max_new_tokens=512,
|
277 |
temperature=0.7,
|