Spaces:
Sleeping
Sleeping
abubasith86
commited on
Commit
·
01cb892
1
Parent(s):
6982b56
Hpoe
Browse files
app.py
CHANGED
@@ -37,6 +37,7 @@ Your goals:
|
|
37 |
- Always be polite, helpful, and respectful.
|
38 |
"""
|
39 |
|
|
|
40 |
def respond(
|
41 |
message,
|
42 |
history: list[tuple[str, str]],
|
@@ -73,21 +74,23 @@ def respond(
|
|
73 |
"""
|
74 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
75 |
"""
|
76 |
-
demo = gr.ChatInterface(
|
77 |
-
respond,
|
78 |
-
additional_inputs=[
|
79 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
80 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
81 |
-
gr.Slider(
|
82 |
-
minimum=0.1,
|
83 |
-
maximum=1.0,
|
84 |
-
value=0.95,
|
85 |
-
step=0.05,
|
86 |
-
label="Top-p (nucleus sampling)",
|
87 |
-
),
|
88 |
-
],
|
89 |
-
)
|
90 |
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
if __name__ == "__main__":
|
93 |
demo.launch()
|
|
|
37 |
- Always be polite, helpful, and respectful.
|
38 |
"""
|
39 |
|
40 |
+
|
41 |
def respond(
|
42 |
message,
|
43 |
history: list[tuple[str, str]],
|
|
|
74 |
"""
|
75 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
76 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
|
79 |
+
with gr.Blocks() as demo:
|
80 |
+
gr.Markdown("## 🤖 Smart AI Chatbot (PDF + Web + General QA)")
|
81 |
+
|
82 |
+
pdf_file = gr.File(label="📄 Upload a PDF", file_types=[".pdf"])
|
83 |
+
|
84 |
+
chat = gr.ChatInterface(
|
85 |
+
respond,
|
86 |
+
additional_inputs=[
|
87 |
+
gr.Textbox(value="You are a helpful assistant.", label="System message"),
|
88 |
+
gr.Slider(1, 2048, value=512, step=1, label="Max new tokens"),
|
89 |
+
gr.Slider(0.1, 4.0, value=0.7, step=0.1, label="Temperature"),
|
90 |
+
gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p"),
|
91 |
+
pdf_file, # ✅ Works now
|
92 |
+
],
|
93 |
+
)
|
94 |
+
|
95 |
if __name__ == "__main__":
|
96 |
demo.launch()
|