Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
-
# Initialize the inference client with
|
5 |
-
client = InferenceClient(
|
|
|
|
|
|
|
6 |
|
7 |
def respond(
|
8 |
message,
|
@@ -13,7 +16,7 @@ def respond(
|
|
13 |
top_p,
|
14 |
):
|
15 |
"""
|
16 |
-
Generate responses for the chatbot using the
|
17 |
|
18 |
Args:
|
19 |
message (str): The current user input message
|
@@ -53,7 +56,7 @@ demo = gr.ChatInterface(
|
|
53 |
respond,
|
54 |
additional_inputs=[
|
55 |
gr.Textbox(
|
56 |
-
value="You are a
|
57 |
label="System message"
|
58 |
),
|
59 |
gr.Slider(
|
@@ -65,7 +68,7 @@ demo = gr.ChatInterface(
|
|
65 |
),
|
66 |
gr.Slider(
|
67 |
minimum=0.1,
|
68 |
-
maximum=
|
69 |
value=0.7,
|
70 |
step=0.1,
|
71 |
label="Temperature"
|
@@ -78,9 +81,9 @@ demo = gr.ChatInterface(
|
|
78 |
label="Top-p (nucleus sampling)"
|
79 |
),
|
80 |
],
|
81 |
-
title="
|
82 |
-
description="A conversational AI powered by
|
83 |
)
|
84 |
|
85 |
if __name__ == "__main__":
|
86 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
+
# Initialize the inference client with a publicly available chat model
|
5 |
+
client = InferenceClient(
|
6 |
+
model="meta-llama/Llama-2-7b-chat-hf", # Using LLaMA 2 chat model
|
7 |
+
token=None # Add your HF token if you have access to LLaMA 2
|
8 |
+
)
|
9 |
|
10 |
def respond(
|
11 |
message,
|
|
|
16 |
top_p,
|
17 |
):
|
18 |
"""
|
19 |
+
Generate responses for the chatbot using the LLaMA 2 chat model.
|
20 |
|
21 |
Args:
|
22 |
message (str): The current user input message
|
|
|
56 |
respond,
|
57 |
additional_inputs=[
|
58 |
gr.Textbox(
|
59 |
+
value="You are a helpful and friendly AI assistant. Provide informative and accurate responses.",
|
60 |
label="System message"
|
61 |
),
|
62 |
gr.Slider(
|
|
|
68 |
),
|
69 |
gr.Slider(
|
70 |
minimum=0.1,
|
71 |
+
maximum=2.0,
|
72 |
value=0.7,
|
73 |
step=0.1,
|
74 |
label="Temperature"
|
|
|
81 |
label="Top-p (nucleus sampling)"
|
82 |
),
|
83 |
],
|
84 |
+
title="LLaMA 2 Chatbot",
|
85 |
+
description="A conversational AI powered by Meta's LLaMA 2 model"
|
86 |
)
|
87 |
|
88 |
if __name__ == "__main__":
|
89 |
+
demo.launch(share=True) # Added share=True to create a public link
|