Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
-
|
5 |
client = InferenceClient(model="HuggingFaceH4/zephyr-7b-beta")
|
6 |
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
def respond(
|
11 |
-
message,
|
12 |
-
history: list[tuple[str, str]],
|
13 |
-
max_tokens,
|
14 |
-
temperature,
|
15 |
-
top_p,
|
16 |
-
):
|
17 |
messages = [{"role": "system", "content": system_message}]
|
18 |
|
19 |
for user_msg, assistant_msg in history:
|
@@ -37,24 +29,14 @@ def respond(
|
|
37 |
response += token
|
38 |
yield response
|
39 |
|
40 |
-
# Create a Gradio ChatInterface with custom styling
|
41 |
-
custom_css = """
|
42 |
-
.css-1rw10a3 {
|
43 |
-
height: 500px; /* Adjust height as needed */
|
44 |
-
overflow-y: scroll; /* Add scrollbar if content exceeds height */
|
45 |
-
}
|
46 |
-
"""
|
47 |
-
|
48 |
demo = gr.ChatInterface(
|
49 |
respond,
|
50 |
additional_inputs=[
|
51 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
52 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
53 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
54 |
-
]
|
55 |
-
css=custom_css, # Apply custom CSS styling
|
56 |
)
|
57 |
|
58 |
-
# Launch the Gradio app
|
59 |
if __name__ == "__main__":
|
60 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
|
|
4 |
client = InferenceClient(model="HuggingFaceH4/zephyr-7b-beta")
|
5 |
|
6 |
+
system_message = "You are MUSK-1, developed by a 14 year old AI engineer, Arjun Singh at Elieon."
|
7 |
|
8 |
+
def respond(message, history, max_tokens, temperature, top_p):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
messages = [{"role": "system", "content": system_message}]
|
10 |
|
11 |
for user_msg, assistant_msg in history:
|
|
|
29 |
response += token
|
30 |
yield response
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
demo = gr.ChatInterface(
|
33 |
respond,
|
34 |
additional_inputs=[
|
35 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
36 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
37 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
38 |
+
]
|
|
|
39 |
)
|
40 |
|
|
|
41 |
if __name__ == "__main__":
|
42 |
+
demo.launch()
|