Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,32 +50,51 @@ css = """
|
|
| 50 |
|
| 51 |
# JavaScript to hide the additional inputs section
|
| 52 |
js = """
|
|
|
|
| 53 |
document.addEventListener("DOMContentLoaded", function() {
|
| 54 |
const additionalInputs = document.querySelector('.additional-inputs-container');
|
| 55 |
if (additionalInputs) {
|
| 56 |
additionalInputs.style.display = 'none';
|
| 57 |
}
|
| 58 |
});
|
|
|
|
| 59 |
"""
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
)
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
demo.launch()
|
|
|
|
| 50 |
|
| 51 |
# JavaScript to hide the additional inputs section
|
| 52 |
js = """
|
| 53 |
+
<script>
|
| 54 |
document.addEventListener("DOMContentLoaded", function() {
|
| 55 |
const additionalInputs = document.querySelector('.additional-inputs-container');
|
| 56 |
if (additionalInputs) {
|
| 57 |
additionalInputs.style.display = 'none';
|
| 58 |
}
|
| 59 |
});
|
| 60 |
+
</script>
|
| 61 |
"""
|
| 62 |
|
| 63 |
+
# Define the layout of the interface, including the JS script
|
| 64 |
+
def create_layout():
|
| 65 |
+
return gr.HTML(f"""
|
| 66 |
+
<html>
|
| 67 |
+
<head>
|
| 68 |
+
<style>
|
| 69 |
+
{css}
|
| 70 |
+
</style>
|
| 71 |
+
</head>
|
| 72 |
+
<body>
|
| 73 |
+
{js}
|
| 74 |
+
<div id="main-interface">
|
| 75 |
+
</div>
|
| 76 |
+
</body>
|
| 77 |
+
</html>
|
| 78 |
+
""")
|
| 79 |
|
| 80 |
+
# Create the Gradio interface with a custom layout
|
| 81 |
+
with gr.Blocks() as demo:
|
| 82 |
+
gr.HTML(create_layout())
|
| 83 |
+
gr.ChatInterface(
|
| 84 |
+
respond,
|
| 85 |
+
additional_inputs=[
|
| 86 |
+
gr.Textbox(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. ", label="System message"),
|
| 87 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 88 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 89 |
+
gr.Slider(
|
| 90 |
+
minimum=0.1,
|
| 91 |
+
maximum=1.0,
|
| 92 |
+
value=0.95,
|
| 93 |
+
step=0.05,
|
| 94 |
+
label="Top-p (nucleus sampling)",
|
| 95 |
+
),
|
| 96 |
+
],
|
| 97 |
+
)
|
| 98 |
|
| 99 |
if __name__ == "__main__":
|
| 100 |
demo.launch()
|