Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import os
|
|
3 |
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex, Settings
|
4 |
from llama_index.llms.openai import OpenAI
|
5 |
|
6 |
-
|
7 |
# Set OpenAI API key from environment
|
8 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
9 |
|
@@ -21,23 +20,43 @@ def chatbot_response(message):
|
|
21 |
response = query_engine.query(message)
|
22 |
return str(response)
|
23 |
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
iface.launch()
|
|
|
3 |
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex, Settings
|
4 |
from llama_index.llms.openai import OpenAI
|
5 |
|
|
|
6 |
# Set OpenAI API key from environment
|
7 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
8 |
|
|
|
20 |
response = query_engine.query(message)
|
21 |
return str(response)
|
22 |
|
23 |
+
# Custom CSS for button styling
|
24 |
+
custom_css = """
|
25 |
+
.gradio-button.primary {
|
26 |
+
background: linear-gradient(45deg, #FF6B6B, #4ECDC4) !important;
|
27 |
+
border: none !important;
|
28 |
+
color: white !important;
|
29 |
+
}
|
30 |
+
|
31 |
+
.gradio-button.primary:hover {
|
32 |
+
background: linear-gradient(45deg, #FF5252, #26C6DA) !important;
|
33 |
+
transform: translateY(-2px);
|
34 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
35 |
+
}
|
36 |
+
|
37 |
+
/* Style example buttons */
|
38 |
+
.examples .gradio-button {
|
39 |
+
background: #667eea !important;
|
40 |
+
color: white !important;
|
41 |
+
border: none !important;
|
42 |
+
border-radius: 8px !important;
|
43 |
+
}
|
44 |
+
|
45 |
+
.examples .gradio-button:hover {
|
46 |
+
background: #5a6fd8 !important;
|
47 |
+
}
|
48 |
+
"""
|
49 |
+
|
50 |
+
iface = gr.Interface(
|
51 |
+
fn=chatbot_response,
|
52 |
+
inputs="text",
|
53 |
+
outputs="text",
|
54 |
+
title="Ask about me",
|
55 |
+
description="Ask questions and receive answers based on my bio.",
|
56 |
+
examples=[["Provide a summary of Donald?"],
|
57 |
+
["Has Donald worked with Python?"],
|
58 |
+
["Tell me something interesting about Donald"]],
|
59 |
+
css=custom_css
|
60 |
+
)
|
61 |
|
62 |
iface.launch()
|