Spaces:
Paused
Paused
updated app.py
Browse files
app.py
CHANGED
@@ -70,6 +70,15 @@ def test_rag(query):
|
|
70 |
|
71 |
return corrected_text_books
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
# OAuth Login Functionality
|
74 |
def oauth_login():
|
75 |
params = {
|
@@ -103,15 +112,15 @@ def on_login(success):
|
|
103 |
with gr.Blocks() as interface:
|
104 |
gr.Markdown("## RAG Chatbot")
|
105 |
gr.Markdown("Ask a question and get answers based on retrieved documents.")
|
|
|
|
|
|
|
|
|
106 |
|
107 |
# Hidden components initially
|
108 |
input_box = gr.Textbox(label="Enter your question", placeholder="Type your question here...", visible=False)
|
109 |
submit_btn = gr.Button("Submit", visible=False)
|
110 |
chat_history = gr.Chatbot(label="Chat History", visible=False)
|
111 |
-
|
112 |
-
# Sign-In Button
|
113 |
-
login_btn = gr.Button("Sign In with HF")
|
114 |
-
login_btn.click(lambda: oauth_login(), outputs=None) # Redirect user for OAuth login
|
115 |
|
116 |
# Show components after login
|
117 |
def show_components():
|
|
|
70 |
|
71 |
return corrected_text_books
|
72 |
|
73 |
+
TENANT_ID = os.getenv("TENANT_ID")
|
74 |
+
CLIENT_ID = os.getenv("OAUTH_CLIENT_ID")
|
75 |
+
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
76 |
+
REDIRECT_URI = os.getenv("SPACE_HOST")
|
77 |
+
AUTH_URL = os.getenv("AUTH_URL")
|
78 |
+
TOKEN_URL = os.getenv("TOKEN_URL")
|
79 |
+
SCOPE = os.getenv("SCOPE")
|
80 |
+
access_token = None
|
81 |
+
|
82 |
# OAuth Login Functionality
|
83 |
def oauth_login():
|
84 |
params = {
|
|
|
112 |
with gr.Blocks() as interface:
|
113 |
gr.Markdown("## RAG Chatbot")
|
114 |
gr.Markdown("Ask a question and get answers based on retrieved documents.")
|
115 |
+
|
116 |
+
# Sign-In Button
|
117 |
+
login_btn = gr.Button("Sign In with HF")
|
118 |
+
login_btn.click(lambda: oauth_login(), outputs=None) # Redirect user for OAuth login
|
119 |
|
120 |
# Hidden components initially
|
121 |
input_box = gr.Textbox(label="Enter your question", placeholder="Type your question here...", visible=False)
|
122 |
submit_btn = gr.Button("Submit", visible=False)
|
123 |
chat_history = gr.Chatbot(label="Chat History", visible=False)
|
|
|
|
|
|
|
|
|
124 |
|
125 |
# Show components after login
|
126 |
def show_components():
|