Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,76 +39,8 @@ def retrieve(query):
|
|
39 |
# Return the most relevant answer based on the query
|
40 |
return answers[corpus[top_result_idx]]
|
41 |
|
42 |
-
# Custom HTML for styling
|
43 |
-
custom_html = """
|
44 |
-
<style>
|
45 |
-
body {
|
46 |
-
background-color: #f4f4f9;
|
47 |
-
font-family: 'Arial', sans-serif;
|
48 |
-
display: flex;
|
49 |
-
justify-content: center;
|
50 |
-
align-items: center;
|
51 |
-
height: 100vh;
|
52 |
-
margin: 0;
|
53 |
-
}
|
54 |
-
.gradio-container {
|
55 |
-
width: 90%;
|
56 |
-
max-width: 600px;
|
57 |
-
padding: 20px;
|
58 |
-
background-color: #ffffff;
|
59 |
-
border-radius: 12px;
|
60 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
61 |
-
}
|
62 |
-
.gradio-button {
|
63 |
-
background-color: #4CAF50;
|
64 |
-
color: white;
|
65 |
-
border: none;
|
66 |
-
border-radius: 8px;
|
67 |
-
padding: 12px 20px;
|
68 |
-
font-size: 16px;
|
69 |
-
transition: background-color 0.3s;
|
70 |
-
}
|
71 |
-
.gradio-button:hover {
|
72 |
-
background-color: #45a049;
|
73 |
-
}
|
74 |
-
.gradio-input {
|
75 |
-
background-color: #fafafa;
|
76 |
-
border: 2px solid #ddd;
|
77 |
-
border-radius: 8px;
|
78 |
-
padding: 12px;
|
79 |
-
font-size: 16px;
|
80 |
-
}
|
81 |
-
.gradio-input:focus {
|
82 |
-
border-color: #4CAF50;
|
83 |
-
}
|
84 |
-
.gradio-title {
|
85 |
-
font-size: 24px;
|
86 |
-
font-weight: 700;
|
87 |
-
text-align: center;
|
88 |
-
color: #333;
|
89 |
-
margin-bottom: 20px;
|
90 |
-
}
|
91 |
-
.gradio-description {
|
92 |
-
font-size: 16px;
|
93 |
-
text-align: center;
|
94 |
-
color: #666;
|
95 |
-
margin-bottom: 20px;
|
96 |
-
}
|
97 |
-
</style>
|
98 |
-
"""
|
99 |
-
|
100 |
# Create Gradio interface
|
101 |
-
iface = gr.Interface(fn=retrieve,
|
102 |
-
inputs="text",
|
103 |
-
outputs="text",
|
104 |
-
live=True,
|
105 |
-
title="RAG AI Bot",
|
106 |
-
description="Ask me anything related to Hugging Face or general knowledge!",
|
107 |
-
theme="compact", # Set a compact, clean theme
|
108 |
-
allow_flagging=False) # Disable flagging to maintain a professional interface
|
109 |
-
|
110 |
-
# Add custom styling
|
111 |
-
iface.interface.css = custom_html
|
112 |
|
113 |
# Launch the Gradio interface
|
114 |
iface.launch()
|
|
|
39 |
# Return the most relevant answer based on the query
|
40 |
return answers[corpus[top_result_idx]]
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
# Create Gradio interface
|
43 |
+
iface = gr.Interface(fn=retrieve, inputs="text", outputs="text", live=True, title="RAG AI Bot", description="Ask me anything related to Hugging Face or general knowledge!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Launch the Gradio interface
|
46 |
iface.launch()
|