Spaces:
Running
Running
Commit
·
1278bcf
1
Parent(s):
fb36012
Update app.py
Browse files
app.py
CHANGED
@@ -135,6 +135,8 @@ def generate_answer(question,openAI_key):
|
|
135 |
|
136 |
|
137 |
def question_answer(url, file, question,openAI_key):
|
|
|
|
|
138 |
if url.strip() == '' and file == None:
|
139 |
return '[ERROR]: Both URL and PDF is empty. Provide atleast one.'
|
140 |
|
@@ -176,6 +178,7 @@ with gr.Blocks() as demo:
|
|
176 |
with gr.Row():
|
177 |
|
178 |
with gr.Group():
|
|
|
179 |
openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
|
180 |
url = gr.Textbox(label='Enter PDF URL here')
|
181 |
gr.Markdown("<center><h4>OR<h4></center>")
|
|
|
135 |
|
136 |
|
137 |
def question_answer(url, file, question,openAI_key):
|
138 |
+
if openAI_key.strip()=='':
|
139 |
+
return '[ERROR]: Please enter you Open AI Key. Get your key here : https://platform.openai.com/account/api-keys'
|
140 |
if url.strip() == '' and file == None:
|
141 |
return '[ERROR]: Both URL and PDF is empty. Provide atleast one.'
|
142 |
|
|
|
178 |
with gr.Row():
|
179 |
|
180 |
with gr.Group():
|
181 |
+
gr.Markdown(f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
|
182 |
openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
|
183 |
url = gr.Textbox(label='Enter PDF URL here')
|
184 |
gr.Markdown("<center><h4>OR<h4></center>")
|