Spaces:
Sleeping
Sleeping
JCai
commited on
Commit
·
d37cbd5
1
Parent(s):
ccc4c36
HF inference error, trying to fix
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from gradio.themes.base import Base
|
|
8 |
from gradio.themes.utils import colors, fonts, sizes
|
9 |
|
10 |
# Inference client setup
|
11 |
-
client = InferenceClient("HuggingFaceH4/zephyr-7b-
|
12 |
pipe = pipeline("text-generation", "microsoft/Phi-3-mini-4k-instruct", torch_dtype=torch.bfloat16, device_map="auto")
|
13 |
|
14 |
# Global flag to handle cancellation
|
@@ -211,7 +211,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
211 |
# submit_btn = gr.Button("Submit", variant="primary")
|
212 |
|
213 |
with gr.Row():
|
214 |
-
|
215 |
use_local_model = gr.Checkbox(label="Use Local Model", value=False)
|
216 |
# button_1 = gr.Button("Submit", variant="primary")
|
217 |
with gr.Row():
|
@@ -226,7 +226,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
226 |
cancel_button = gr.Button("Cancel Inference", variant="danger")
|
227 |
|
228 |
# Adjusted to ensure history is maintained and passed correctly
|
229 |
-
user_input.submit(respond, [user_input, chat_history, max_tokens, temperature, top_p, use_local_model], chat_history)
|
230 |
|
231 |
cancel_button.click(cancel_inference)
|
232 |
|
|
|
8 |
from gradio.themes.utils import colors, fonts, sizes
|
9 |
|
10 |
# Inference client setup
|
11 |
+
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
12 |
pipe = pipeline("text-generation", "microsoft/Phi-3-mini-4k-instruct", torch_dtype=torch.bfloat16, device_map="auto")
|
13 |
|
14 |
# Global flag to handle cancellation
|
|
|
211 |
# submit_btn = gr.Button("Submit", variant="primary")
|
212 |
|
213 |
with gr.Row():
|
214 |
+
system_message = gr.Textbox(value="You are a friendly and playful chatbot with a love for cats. Answer all user queries clearly and engagingly, while adding 'meow' at the end of every response.", label="System message", interactive=True)
|
215 |
use_local_model = gr.Checkbox(label="Use Local Model", value=False)
|
216 |
# button_1 = gr.Button("Submit", variant="primary")
|
217 |
with gr.Row():
|
|
|
226 |
cancel_button = gr.Button("Cancel Inference", variant="danger")
|
227 |
|
228 |
# Adjusted to ensure history is maintained and passed correctly
|
229 |
+
user_input.submit(respond, [user_input, chat_history, system_message, max_tokens, temperature, top_p, use_local_model], chat_history)
|
230 |
|
231 |
cancel_button.click(cancel_inference)
|
232 |
|