Create app1.py
Browse files
app1.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, system_message, max_tokens, temperature, top_p):
|
7 |
+
# ... (same as before)
|
8 |
+
|
9 |
+
def clear_history():
|
10 |
+
return [], "" # Return empty history and message
|
11 |
+
|
12 |
+
demo = gr.ChatInterface(
|
13 |
+
respond,
|
14 |
+
title="MediPro",
|
15 |
+
additional_inputs=[
|
16 |
+
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
17 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
18 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
19 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="MediPro"),
|
20 |
+
],
|
21 |
+
container=gr.Container(
|
22 |
+
gr.ChatHistory(id="chat-history"),
|
23 |
+
gr.Button("New Chat", id="new-chat-button", onclick=clear_history),
|
24 |
+
),
|
25 |
+
)
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
demo.launch()
|