Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,8 @@ from huggingface_hub.inference._generated.types.chat_completion import ChatCompl
|
|
7 |
MODEL = "nomiChroma3.1"
|
8 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
9 |
|
|
|
|
|
10 |
def respond(
|
11 |
message,
|
12 |
history: list[tuple[str, str]],
|
@@ -69,36 +71,7 @@ def respond(
|
|
69 |
else:
|
70 |
yield f"An error occurred: {e}"
|
71 |
|
72 |
-
#
|
73 |
-
custom_css = """
|
74 |
-
.gradio-container {
|
75 |
-
background-color: #e6f3ff !important;
|
76 |
-
}
|
77 |
-
.chat-window {
|
78 |
-
background-color: #f0f8ff !important;
|
79 |
-
}
|
80 |
-
.message.user, .message.bot {
|
81 |
-
background-color: #e6f3ff !important;
|
82 |
-
border: 1px solid #cce4ff !important;
|
83 |
-
padding: 15px !important;
|
84 |
-
border-radius: 8px !important;
|
85 |
-
}
|
86 |
-
.message.user {
|
87 |
-
background-color: #e1f0ff !important;
|
88 |
-
}
|
89 |
-
.message.bot {
|
90 |
-
background-color: #e6f3ff !important;
|
91 |
-
}
|
92 |
-
.input-box, .output-box {
|
93 |
-
background-color: #e6f3ff !important;
|
94 |
-
border: 1px solid #cce4ff !important;
|
95 |
-
}
|
96 |
-
textarea {
|
97 |
-
background-color: #e6f3ff !important;
|
98 |
-
}
|
99 |
-
"""
|
100 |
-
|
101 |
-
# Gradio interface setup with custom theme
|
102 |
demo = gr.ChatInterface(
|
103 |
respond,
|
104 |
additional_inputs=[
|
@@ -118,20 +91,15 @@ demo = gr.ChatInterface(
|
|
118 |
],
|
119 |
title="Maritime Legal Compliance",
|
120 |
description="This chatbot uses Fine-tuned LLAMA-3.1 model personalised specifically to provide assistance with Indian maritime legal queries.",
|
121 |
-
theme=
|
122 |
-
primary_hue="blue",
|
123 |
-
secondary_hue="blue",
|
124 |
-
neutral_hue="blue",
|
125 |
-
).set_background(color="#e6f3ff"),
|
126 |
examples=[
|
127 |
["What are the key regulations governing ports in India?"],
|
128 |
["Explain the concept of cabotage in Indian maritime law."],
|
129 |
["What are the legal requirements for registering a vessel in India?"],
|
130 |
],
|
131 |
-
css=custom_css,
|
132 |
cache_examples=False,
|
133 |
)
|
134 |
|
135 |
# Launch the Gradio app
|
136 |
-
if
|
137 |
demo.launch()
|
|
|
7 |
MODEL = "nomiChroma3.1"
|
8 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
9 |
|
10 |
+
from huggingface_hub.inference._generated.types.chat_completion import ChatCompletionStreamOutput
|
11 |
+
|
12 |
def respond(
|
13 |
message,
|
14 |
history: list[tuple[str, str]],
|
|
|
71 |
else:
|
72 |
yield f"An error occurred: {e}"
|
73 |
|
74 |
+
# Gradio interface setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
demo = gr.ChatInterface(
|
76 |
respond,
|
77 |
additional_inputs=[
|
|
|
91 |
],
|
92 |
title="Maritime Legal Compliance",
|
93 |
description="This chatbot uses Fine-tuned LLAMA-3.1 model personalised specifically to provide assistance with Indian maritime legal queries.",
|
94 |
+
theme="soft",
|
|
|
|
|
|
|
|
|
95 |
examples=[
|
96 |
["What are the key regulations governing ports in India?"],
|
97 |
["Explain the concept of cabotage in Indian maritime law."],
|
98 |
["What are the legal requirements for registering a vessel in India?"],
|
99 |
],
|
|
|
100 |
cache_examples=False,
|
101 |
)
|
102 |
|
103 |
# Launch the Gradio app
|
104 |
+
if _name_ == "_main_":
|
105 |
demo.launch()
|