Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,82 +11,6 @@ MODEL = "nomiChroma3.1"
|
|
11 |
|
12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
13 |
|
14 |
-
# Custom CSS for modern dark theme
|
15 |
-
custom_css = """
|
16 |
-
body {
|
17 |
-
background-color: #121212;
|
18 |
-
color: #e0e0e0;
|
19 |
-
font-family: 'Roboto', sans-serif;
|
20 |
-
margin: 0;
|
21 |
-
padding: 0;
|
22 |
-
}
|
23 |
-
.gradio-container {
|
24 |
-
background-color: #1e1e1e !important;
|
25 |
-
border-radius: 12px;
|
26 |
-
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
27 |
-
padding: 20px;
|
28 |
-
max-width: 900px;
|
29 |
-
margin: 40px auto;
|
30 |
-
}
|
31 |
-
.gradio-container .gr-inputs {
|
32 |
-
margin-bottom: 20px;
|
33 |
-
}
|
34 |
-
.gradio-container .gr-button {
|
35 |
-
background-color: #3b3b3b !important;
|
36 |
-
border: none;
|
37 |
-
border-radius: 8px;
|
38 |
-
color: #ffffff !important;
|
39 |
-
font-size: 15px;
|
40 |
-
font-weight: bold;
|
41 |
-
padding: 10px 20px;
|
42 |
-
transition: background-color 0.3s ease;
|
43 |
-
}
|
44 |
-
.gradio-container .gr-button:hover {
|
45 |
-
background-color: #575757 !important;
|
46 |
-
}
|
47 |
-
.gradio-container .gr-textbox textarea {
|
48 |
-
background-color: #2a2a2a !important;
|
49 |
-
color: #e0e0e0 !important;
|
50 |
-
border: 1px solid #555 !important;
|
51 |
-
border-radius: 8px;
|
52 |
-
padding: 10px;
|
53 |
-
transition: border-color 0.3s ease;
|
54 |
-
}
|
55 |
-
.gradio-container .gr-textbox textarea:focus {
|
56 |
-
border-color: #007bff !important;
|
57 |
-
}
|
58 |
-
.gradio-container .gr-slider {
|
59 |
-
margin: 10px 0;
|
60 |
-
}
|
61 |
-
.gradio-container .gr-slider .gr-slider-container {
|
62 |
-
background-color: #2a2a2a !important;
|
63 |
-
border-radius: 12px;
|
64 |
-
padding: 10px;
|
65 |
-
}
|
66 |
-
.gradio-container .gr-slider .gr-slider-value {
|
67 |
-
background-color: #007bff !important;
|
68 |
-
border-radius: 8px;
|
69 |
-
height: 6px;
|
70 |
-
}
|
71 |
-
.gradio-container .gr-chat-box {
|
72 |
-
border: 1px solid #2a2a2a !important;
|
73 |
-
border-radius: 12px;
|
74 |
-
padding: 20px;
|
75 |
-
background-color: #2a2a2a !important;
|
76 |
-
}
|
77 |
-
.gradio-container .gr-chat-box .gr-chat-bubble {
|
78 |
-
border-radius: 8px;
|
79 |
-
padding: 10px;
|
80 |
-
}
|
81 |
-
.gradio-container .gr-chat-box .gr-chat-bubble-user {
|
82 |
-
background-color: #007bff !important;
|
83 |
-
color: #ffffff !important;
|
84 |
-
}
|
85 |
-
.gradio-container .gr-chat-box .gr-chat-bubble-assistant {
|
86 |
-
background-color: #333333 !important;
|
87 |
-
color: #e0e0e0 !important;
|
88 |
-
}
|
89 |
-
"""
|
90 |
|
91 |
def respond(
|
92 |
message,
|
@@ -120,17 +44,13 @@ def respond(
|
|
120 |
response += token
|
121 |
yield response
|
122 |
|
123 |
-
|
|
|
|
|
124 |
demo = gr.ChatInterface(
|
125 |
respond,
|
126 |
additional_inputs=[
|
127 |
-
gr.Textbox(
|
128 |
-
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.",
|
129 |
-
label="System message",
|
130 |
-
placeholder="Enter system instructions...",
|
131 |
-
lines=3,
|
132 |
-
max_lines=5
|
133 |
-
),
|
134 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
135 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
136 |
gr.Slider(
|
@@ -138,14 +58,13 @@ demo = gr.ChatInterface(
|
|
138 |
maximum=1.0,
|
139 |
value=0.95,
|
140 |
step=0.05,
|
141 |
-
label="Top-p (nucleus sampling)"
|
142 |
),
|
143 |
],
|
144 |
-
theme="dark",
|
145 |
title="Maritime Legal Compliance",
|
146 |
-
description="This chatbot uses the fine
|
147 |
-
css=custom_css
|
148 |
)
|
149 |
|
|
|
150 |
if __name__ == "__main__":
|
151 |
-
demo.launch()
|
|
|
11 |
|
12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def respond(
|
16 |
message,
|
|
|
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(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. You have no word limit.", label="System message"),
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
55 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
56 |
gr.Slider(
|
|
|
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 tune Llama 3.1 which has the capabilities of responding and helping in legal advices regarding maritime",
|
|
|
66 |
)
|
67 |
|
68 |
+
|
69 |
if __name__ == "__main__":
|
70 |
+
demo.launch()
|