Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,41 @@ MODEL = "nomiChroma3.1"
|
|
11 |
|
12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def respond(
|
16 |
message,
|
@@ -44,27 +79,33 @@ def respond(
|
|
44 |
response += token
|
45 |
yield response
|
46 |
|
47 |
-
|
48 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
49 |
-
"""
|
50 |
demo = gr.ChatInterface(
|
51 |
respond,
|
52 |
additional_inputs=[
|
53 |
-
gr.Textbox(
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
56 |
gr.Slider(
|
57 |
minimum=0.1,
|
58 |
maximum=1.0,
|
59 |
value=0.95,
|
60 |
step=0.05,
|
61 |
label="Top-p (nucleus sampling)",
|
|
|
62 |
),
|
63 |
],
|
|
|
64 |
title="Maritime Legal Compliance",
|
65 |
-
description="This chatbot uses the fine
|
|
|
|
|
66 |
)
|
67 |
|
68 |
-
|
69 |
if __name__ == "__main__":
|
70 |
demo.launch()
|
|
|
11 |
|
12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
13 |
|
14 |
+
# Custom CSS for dark theme and modern aesthetics
|
15 |
+
custom_css = """
|
16 |
+
body {
|
17 |
+
background-color: #1f1f1f;
|
18 |
+
color: #e0e0e0;
|
19 |
+
font-family: 'Arial', sans-serif;
|
20 |
+
}
|
21 |
+
.gr-button {
|
22 |
+
background-color: #4A4A4A !important;
|
23 |
+
border: 1px solid #333 !important;
|
24 |
+
color: #ffffff !important;
|
25 |
+
}
|
26 |
+
.gr-button:hover {
|
27 |
+
background-color: #3a3a3a !important;
|
28 |
+
border-color: #555 !important;
|
29 |
+
}
|
30 |
+
.gr-textbox {
|
31 |
+
border-color: #555 !important;
|
32 |
+
color: #ffffff !important;
|
33 |
+
}
|
34 |
+
.gr-slider {
|
35 |
+
color: #ffffff !important;
|
36 |
+
}
|
37 |
+
.gr-textbox textarea {
|
38 |
+
background-color: #333 !important;
|
39 |
+
color: #ffffff !important;
|
40 |
+
}
|
41 |
+
.gr-slider input[type=range] {
|
42 |
+
background-color: #4A4A4A !important;
|
43 |
+
}
|
44 |
+
.gr-box {
|
45 |
+
background-color: #292929 !important;
|
46 |
+
border-color: #444 !important;
|
47 |
+
}
|
48 |
+
"""
|
49 |
|
50 |
def respond(
|
51 |
message,
|
|
|
79 |
response += token
|
80 |
yield response
|
81 |
|
82 |
+
# Updated ChatInterface with dark theme and modern layout
|
|
|
|
|
83 |
demo = gr.ChatInterface(
|
84 |
respond,
|
85 |
additional_inputs=[
|
86 |
+
gr.Textbox(
|
87 |
+
value="You are a maritime legal assistant with expertise strictly in Indian maritime law. Provide detailed legal advice and information based on Indian maritime legal principles and regulations.",
|
88 |
+
label="System message",
|
89 |
+
placeholder="Enter system instructions...",
|
90 |
+
elem_classes="custom-textbox"
|
91 |
+
),
|
92 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", elem_classes="custom-slider"),
|
93 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", elem_classes="custom-slider"),
|
94 |
gr.Slider(
|
95 |
minimum=0.1,
|
96 |
maximum=1.0,
|
97 |
value=0.95,
|
98 |
step=0.05,
|
99 |
label="Top-p (nucleus sampling)",
|
100 |
+
elem_classes="custom-slider"
|
101 |
),
|
102 |
],
|
103 |
+
theme="dark",
|
104 |
title="Maritime Legal Compliance",
|
105 |
+
description="This chatbot uses the fine-tuned Llama 3.1 model to provide legal advice on maritime law with a focus on Indian maritime regulations.",
|
106 |
+
css=custom_css,
|
107 |
+
elem_classes="custom-container"
|
108 |
)
|
109 |
|
|
|
110 |
if __name__ == "__main__":
|
111 |
demo.launch()
|