Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
"""
|
@@ -7,14 +8,16 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
messages = [{"role": "system", "content": system_message}]
|
19 |
|
20 |
for val in history:
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
from huggingface_hub import InferenceClient
|
4 |
|
5 |
"""
|
|
|
8 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
9 |
|
10 |
|
11 |
+
PERSONALITY = os.environ.get("CHATBOT_PERSONALITY", "You are a helpful assistant.")
|
12 |
+
|
13 |
+
def chatbot(message, history):
|
14 |
+
custom_prompt = PERSONALITY + "\n\nUser: " + message + "\nChatbot:"
|
15 |
+
response = generate_response(custom_prompt, history) # Hypothetical function
|
16 |
+
history.append((message, response))
|
17 |
+
return history
|
18 |
+
|
19 |
+
def generate_response(prompt, history):
|
20 |
+
return "Olá! Eu sou Shinobi! E sou um especialista em cultura japonesa, ou tento ser pelo menos."
|
21 |
messages = [{"role": "system", "content": system_message}]
|
22 |
|
23 |
for val in history:
|