Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,8 @@ from huggingface_hub import InferenceClient
|
|
4 |
"""
|
5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
"""
|
7 |
-
|
|
|
8 |
|
9 |
|
10 |
def respond(
|
@@ -15,7 +16,7 @@ def respond(
|
|
15 |
temperature,
|
16 |
top_p,
|
17 |
):
|
18 |
-
# Set system message in Indonesian
|
19 |
system_message = "Hai, apa ada yang bisa saya bantu?"
|
20 |
|
21 |
messages = [{"role": "system", "content": system_message}]
|
@@ -26,6 +27,10 @@ def respond(
|
|
26 |
if val[1]:
|
27 |
messages.append({"role": "assistant", "content": val[1]})
|
28 |
|
|
|
|
|
|
|
|
|
29 |
messages.append({"role": "user", "content": message})
|
30 |
|
31 |
response = ""
|
@@ -38,7 +43,6 @@ def respond(
|
|
38 |
top_p=top_p,
|
39 |
):
|
40 |
token = message.choices[0].delta.content
|
41 |
-
|
42 |
response += token
|
43 |
yield response
|
44 |
|
|
|
4 |
"""
|
5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
"""
|
7 |
+
# Menggunakan model Gemini yang tersedia di HuggingFace
|
8 |
+
client = InferenceClient("google/gemini-xx") # Gantilah dengan nama model Gemini yang tepat
|
9 |
|
10 |
|
11 |
def respond(
|
|
|
16 |
temperature,
|
17 |
top_p,
|
18 |
):
|
19 |
+
# Set system message to greet in Indonesian
|
20 |
system_message = "Hai, apa ada yang bisa saya bantu?"
|
21 |
|
22 |
messages = [{"role": "system", "content": system_message}]
|
|
|
27 |
if val[1]:
|
28 |
messages.append({"role": "assistant", "content": val[1]})
|
29 |
|
30 |
+
# Menambahkan pertanyaan tentang Riswan
|
31 |
+
if message.lower() == "siapa riswan?":
|
32 |
+
messages.append({"role": "user", "content": "Siapa Riswan dan apa yang dia buat?"})
|
33 |
+
|
34 |
messages.append({"role": "user", "content": message})
|
35 |
|
36 |
response = ""
|
|
|
43 |
top_p=top_p,
|
44 |
):
|
45 |
token = message.choices[0].delta.content
|
|
|
46 |
response += token
|
47 |
yield response
|
48 |
|