Spaces:
Sleeping
Sleeping
moctardiallo
commited on
Commit
•
12fa8e8
1
Parent(s):
d37a151
Improve UI/UX layout
Browse files- app.py +24 -16
- requirements.txt +4 -1
app.py
CHANGED
@@ -10,7 +10,6 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
10 |
"""
|
11 |
client = InferenceClient("meta-llama/Llama-3.2-1B-Instruct", token=os.getenv("HUGGINGFACEHUB_API_TOKEN"))
|
12 |
|
13 |
-
|
14 |
def respond(
|
15 |
message,
|
16 |
history: list[tuple[str, str]],
|
@@ -63,21 +62,30 @@ Helpful Answers:
|
|
63 |
"""
|
64 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
65 |
"""
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
if __name__ == "__main__":
|
|
|
10 |
"""
|
11 |
client = InferenceClient("meta-llama/Llama-3.2-1B-Instruct", token=os.getenv("HUGGINGFACEHUB_API_TOKEN"))
|
12 |
|
|
|
13 |
def respond(
|
14 |
message,
|
15 |
history: list[tuple[str, str]],
|
|
|
62 |
"""
|
63 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
64 |
"""
|
65 |
+
with gr.Blocks() as demo:
|
66 |
+
with gr.Row():
|
67 |
+
with gr.Column(min_width=200, scale=0):
|
68 |
+
max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", render=True)
|
69 |
+
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", render=True)
|
70 |
+
top_p = gr.Slider(
|
71 |
+
minimum=0.1,
|
72 |
+
maximum=1.0,
|
73 |
+
value=0.95,
|
74 |
+
step=0.05,
|
75 |
+
label="Top-p (nucleus sampling)",
|
76 |
+
render=True,
|
77 |
+
)
|
78 |
+
with gr.Column():
|
79 |
+
url = gr.Textbox(value="https://www.gradio.app/docs/gradio/chatinterface", label="Docs URL", render=True)
|
80 |
+
chat = gr.ChatInterface(
|
81 |
+
respond,
|
82 |
+
additional_inputs=[
|
83 |
+
url,
|
84 |
+
max_tokens,
|
85 |
+
temperature,
|
86 |
+
top_p,
|
87 |
+
],
|
88 |
+
)
|
89 |
|
90 |
|
91 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
huggingface_hub==0.25.2
|
|
|
|
|
|
|
|
1 |
+
huggingface_hub==0.25.2
|
2 |
+
langchain-community==0.3.3
|
3 |
+
unstructured==0.16.0
|
4 |
+
unstructured-client==0.26.1
|