Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
| 9 |
-
|
| 10 |
def respond(
|
| 11 |
message,
|
| 12 |
history: list[tuple[str, str]],
|
|
@@ -42,50 +41,41 @@ def respond(
|
|
| 42 |
"""
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 44 |
"""
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
<script>
|
| 48 |
-
document.addEventListener("DOMContentLoaded", function() {
|
| 49 |
-
const additionalInputs = document.querySelector('.additional-inputs-container');
|
| 50 |
-
if (additionalInputs) {
|
| 51 |
-
additionalInputs.style.display = 'none';
|
| 52 |
-
}
|
| 53 |
-
});
|
| 54 |
-
</script>
|
| 55 |
-
"""
|
| 56 |
-
|
| 57 |
-
# Define the layout of the interface, including the JS script
|
| 58 |
-
def create_layout():
|
| 59 |
-
return f"""
|
| 60 |
-
<head>
|
| 61 |
-
<style>
|
| 62 |
-
/* Any additional styles can go here */
|
| 63 |
-
</style>
|
| 64 |
-
</head>
|
| 65 |
-
<body>
|
| 66 |
-
{js}
|
| 67 |
-
<div id="main-interface"></div>
|
| 68 |
-
</body>
|
| 69 |
-
"""
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
if __name__ == "__main__":
|
| 91 |
demo.launch()
|
|
|
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
|
|
|
| 9 |
def respond(
|
| 10 |
message,
|
| 11 |
history: list[tuple[str, str]],
|
|
|
|
| 41 |
"""
|
| 42 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 43 |
"""
|
| 44 |
+
demo = gr.ChatInterface(
|
| 45 |
+
respond,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
additional_inputs=[
|
| 48 |
+
gr.Textbox(
|
| 49 |
+
value="You are a friendly Chatbot. your default language is the user language. your name is Maya. developer from Qspace Corporation, a small project whit 10 teenagers. Qspace isn't a registred company. it is founded 11 July 2022 in Martellago (Ve) in Italy. ",
|
| 50 |
+
label="System message",
|
| 51 |
+
visible=False
|
| 52 |
+
),
|
| 53 |
+
gr.Slider(
|
| 54 |
+
minimum=1,
|
| 55 |
+
maximum=2048,
|
| 56 |
+
value=512,
|
| 57 |
+
step=1,
|
| 58 |
+
label="Max new tokens",
|
| 59 |
+
visible=False
|
| 60 |
+
),
|
| 61 |
+
gr.Slider(
|
| 62 |
+
minimum=0.1,
|
| 63 |
+
maximum=4.0,
|
| 64 |
+
value=0.7,
|
| 65 |
+
step=0.1,
|
| 66 |
+
label="Temperature",
|
| 67 |
+
visible=False
|
| 68 |
+
),
|
| 69 |
+
gr.Slider(
|
| 70 |
+
minimum=0.1,
|
| 71 |
+
maximum=1.0,
|
| 72 |
+
value=0.95,
|
| 73 |
+
step=0.05,
|
| 74 |
+
label="Top-p (nucleus sampling)",
|
| 75 |
+
visible=False
|
| 76 |
+
),
|
| 77 |
+
],
|
| 78 |
+
)
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
demo.launch()
|