Spaces:
Sleeping
Sleeping
transitionaing to gen ai model
Browse files
app.py
CHANGED
|
@@ -1,26 +1,23 @@
|
|
| 1 |
-
import random
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
print(message)
|
| 6 |
-
print(history)
|
| 7 |
-
return message
|
| 8 |
|
| 9 |
-
def
|
| 10 |
-
|
| 11 |
-
neutral_messages=["reply hazy", "try again", "ask again later", "better not tell you now", "cannot predict now", "concentrate and ask again"]
|
| 12 |
-
negative_messages=["don't count on it", "my reply is no", "my sources say no", "outlook not so good", "very doubtful"]
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
affirmative_messages=["ofc girl", "yesss omg", "defnitly ehhe"]
|
| 19 |
-
neutral_messages=["uhhh lowk idk", "idek", "manifesting", "ur asking too much of me"]
|
| 20 |
-
negative_messages=["bru nah", "stay delulu cuz its not gonna happen", "nuh uh"]
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
chatbot.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
def respond(message, history):
|
| 7 |
+
messages = [{"role": "system", "content": "Your are friend chatbot"}]
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
if history:
|
| 10 |
+
messages.extend(history)
|
| 11 |
|
| 12 |
+
messages.append({"role": "user", "content": message})
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
response = client.chat_completion(
|
| 15 |
+
messages,
|
| 16 |
+
max_tokens=100,
|
| 17 |
+
temperature=0.2
|
| 18 |
+
)
|
| 19 |
|
| 20 |
+
return response["choices"][0]["message"]["content"].strip()
|
| 21 |
+
|
| 22 |
+
chatbot = gr.ChatInterface(eight_ball_but_its_just_me, type="messages")
|
| 23 |
chatbot.launch()
|