Spaces:
Sleeping
Sleeping
Commit ·
052f9cb
1
Parent(s): ed2a31a
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,29 +3,27 @@ import gradio as gr
|
|
| 3 |
import os
|
| 4 |
import requests
|
| 5 |
|
|
|
|
| 6 |
hf_token = os.getenv("HF_TOKEN")
|
| 7 |
llama_7b = os.getenv("API_URL_LLAMA_7")
|
| 8 |
llama_13b = os.getenv("API_URL_LLAMA_13")
|
| 9 |
zephyr_7b = os.getenv("API_URL_ZEPHYR_7")
|
| 10 |
|
| 11 |
-
#api_url_70b = os.getenv("API_URL_LLAMA_70")
|
| 12 |
-
|
| 13 |
headers = {
|
| 14 |
'Content-Type': 'application/json',
|
| 15 |
}
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
def predict(message,
|
| 22 |
chatbot,
|
| 23 |
system_prompt = "",
|
| 24 |
temperature = 0.9,
|
| 25 |
max_new_tokens = 256,
|
| 26 |
top_p = 0.6,
|
| 27 |
repetition_penalty = 1.0,
|
| 28 |
-
model=
|
| 29 |
|
| 30 |
# Write the system prompt
|
| 31 |
if system_prompt != "":
|
|
@@ -94,7 +92,7 @@ def predict(message,
|
|
| 94 |
|
| 95 |
|
| 96 |
additional_inputs=[
|
| 97 |
-
|
| 98 |
gr.Textbox("", label="Optional system prompt"),
|
| 99 |
gr.Slider(
|
| 100 |
label="Temperature",
|
|
@@ -132,12 +130,15 @@ additional_inputs=[
|
|
| 132 |
interactive=True,
|
| 133 |
info="Penalize repeated tokens",
|
| 134 |
)
|
| 135 |
-
|
| 136 |
]
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
chatbot = gr.Chatbot(avatar_images=('user.png', 'bot2.png'),bubble_full_width = False)
|
| 139 |
|
| 140 |
-
|
| 141 |
|
| 142 |
chat_interface = gr.ChatInterface(predict,
|
| 143 |
title=title,
|
|
|
|
| 3 |
import os
|
| 4 |
import requests
|
| 5 |
|
| 6 |
+
# We get the token and the models API url
|
| 7 |
hf_token = os.getenv("HF_TOKEN")
|
| 8 |
llama_7b = os.getenv("API_URL_LLAMA_7")
|
| 9 |
llama_13b = os.getenv("API_URL_LLAMA_13")
|
| 10 |
zephyr_7b = os.getenv("API_URL_ZEPHYR_7")
|
| 11 |
|
|
|
|
|
|
|
| 12 |
headers = {
|
| 13 |
'Content-Type': 'application/json',
|
| 14 |
}
|
| 15 |
|
| 16 |
+
"""
|
| 17 |
+
Chat Function
|
| 18 |
+
"""
|
| 19 |
+
def chat(message,
|
|
|
|
| 20 |
chatbot,
|
| 21 |
system_prompt = "",
|
| 22 |
temperature = 0.9,
|
| 23 |
max_new_tokens = 256,
|
| 24 |
top_p = 0.6,
|
| 25 |
repetition_penalty = 1.0,
|
| 26 |
+
model= llama_13b):
|
| 27 |
|
| 28 |
# Write the system prompt
|
| 29 |
if system_prompt != "":
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
additional_inputs=[
|
| 95 |
+
model = gr.Dropdown(["llama_7b", "llama_13b", "zephyr_7b"], label="Model", info="Which model do you want to use?")
|
| 96 |
gr.Textbox("", label="Optional system prompt"),
|
| 97 |
gr.Slider(
|
| 98 |
label="Temperature",
|
|
|
|
| 130 |
interactive=True,
|
| 131 |
info="Penalize repeated tokens",
|
| 132 |
)
|
|
|
|
| 133 |
]
|
| 134 |
|
| 135 |
+
title = "Find the password 🔒"
|
| 136 |
+
description = "In this game prototype, your goal is to discuss with the intercom to find the correct password"
|
| 137 |
+
|
| 138 |
+
|
| 139 |
chatbot = gr.Chatbot(avatar_images=('user.png', 'bot2.png'),bubble_full_width = False)
|
| 140 |
|
| 141 |
+
|
| 142 |
|
| 143 |
chat_interface = gr.ChatInterface(predict,
|
| 144 |
title=title,
|