Unizomby commited on
Commit
be1510f
·
verified ·
1 Parent(s): 4116163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -19
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
- # # Define inline CSS for button styling
25
- # custom_css = """
26
- # .gr-button-primary {
27
- # background-color: #6e57e0 !important;
28
- # color: white !important;
29
- # }
30
- # """
31
-
32
- iface = gr.Interface(fn=chatbot_response,
33
- inputs="text",
34
- outputs="text",
35
- title="Ask about me",
36
- description="Ask questions and receive answers based on my bio.",
37
- # css=custom_css,
38
- examples=[["Provide a summary of Donald?"],
39
- ["Has Donald worked with Python?"],
40
- ["Tell me something interesting about Donald"]]
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()