Spaces:
Running
Running
Update flashcard_util.py
Browse files- flashcard_util.py +2 -2
flashcard_util.py
CHANGED
@@ -41,7 +41,7 @@ async def fetch_img_for_words(words: list[str]):
|
|
41 |
_img_link = [search_img(r) for r in words]
|
42 |
return [(word,img) for (word, img) in zip(words, _img_link)]
|
43 |
|
44 |
-
async def get_definitions_from_words(words: list[str], summary: str = ""):
|
45 |
print("running inferrence")
|
46 |
_r = requests.post(
|
47 |
url="https://api.awanllm.com/v1/chat/completions",
|
@@ -49,7 +49,7 @@ async def get_definitions_from_words(words: list[str], summary: str = ""):
|
|
49 |
data=json.dumps({
|
50 |
"model": "Meta-Llama-3-8B-Instruct",
|
51 |
"messages": [
|
52 |
-
{"role": "user", "content": f"{summary}. Based on this paragraph and your knowledge, give concise, easy-to-understand definitions for the following
|
53 |
],
|
54 |
"presence_penalty":0.3,
|
55 |
"temperature":0.55
|
|
|
41 |
_img_link = [search_img(r) for r in words]
|
42 |
return [(word,img) for (word, img) in zip(words, _img_link)]
|
43 |
|
44 |
+
async def get_definitions_from_words(words: list[str], summary: str = "", lang: str = lang.VI_VN):
|
45 |
print("running inferrence")
|
46 |
_r = requests.post(
|
47 |
url="https://api.awanllm.com/v1/chat/completions",
|
|
|
49 |
data=json.dumps({
|
50 |
"model": "Meta-Llama-3-8B-Instruct",
|
51 |
"messages": [
|
52 |
+
{"role": "user", "content": f"{summary}. Based on this paragraph and your knowledge, give concise, easy-to-understand definitions for the following keywords: {'; '.join(words)}. DO NOT include the keywords inside their respective definition. Use {lang}."}
|
53 |
],
|
54 |
"presence_penalty":0.3,
|
55 |
"temperature":0.55
|