Spaces:
Sleeping
Sleeping
HanaeRateau
commited on
Merge branch main
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ def chatCompletion(text):
|
|
54 |
{"role": "user", "content": "You are a helpful assistant. Answer in English only in text.\n\n"+text},
|
55 |
]
|
56 |
|
57 |
-
try:
|
58 |
response: ollama.ListResponse = ollama.list()
|
59 |
|
60 |
response = client.chat(
|
@@ -74,7 +74,7 @@ def chatCompletion(text):
|
|
74 |
|
75 |
print(f'[chatCompletion] {buffer}')
|
76 |
return buffer
|
77 |
-
except:
|
78 |
outputs = llmpipe(messages, max_new_tokens=256)
|
79 |
buffer = outputs[0]["generated_text"][-1]["content"].strip()
|
80 |
|
|
|
54 |
{"role": "user", "content": "You are a helpful assistant. Answer in English only in text.\n\n"+text},
|
55 |
]
|
56 |
|
57 |
+
try: # try to get a ollama client
|
58 |
response: ollama.ListResponse = ollama.list()
|
59 |
|
60 |
response = client.chat(
|
|
|
74 |
|
75 |
print(f'[chatCompletion] {buffer}')
|
76 |
return buffer
|
77 |
+
except: # get a HF piepline LLM
|
78 |
outputs = llmpipe(messages, max_new_tokens=256)
|
79 |
buffer = outputs[0]["generated_text"][-1]["content"].strip()
|
80 |
|