Merge pull request #79 from weartist/main

commit some minor modifications
pull/81/head
Bhaskar Tripathi 1 year ago committed by GitHub
commit 32d9f880a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,7 +47,6 @@ def pdf_to_text(path, start_page=1, end_page=None):
def text_to_chunks(texts, word_length=150, start_page=1): def text_to_chunks(texts, word_length=150, start_page=1):
text_toks = [t.split(' ') for t in texts] text_toks = [t.split(' ') for t in texts]
page_nums = []
chunks = [] chunks = []
for idx, words in enumerate(text_toks): for idx, words in enumerate(text_toks):

@ -16,10 +16,10 @@ def ask_api(
return '[ERROR]: Invalid API Host' return '[ERROR]: Invalid API Host'
if url.strip() == '' and file == None: if url.strip() == '' and file == None:
return '[ERROR]: Both URL and PDF is empty. Provide atleast one.' return '[ERROR]: Both URL and PDF is empty. Provide at least one.'
if url.strip() != '' and file != None: if url.strip() != '' and file != None:
return '[ERROR]: Both URL and PDF is provided. Please provide only one (eiter URL or PDF).' return '[ERROR]: Both URL and PDF is provided. Please provide only one (either URL or PDF).'
if question.strip() == '': if question.strip() == '':
return '[ERROR]: Question field is empty' return '[ERROR]: Question field is empty'
@ -66,7 +66,7 @@ with gr.Blocks() as demo:
placeholder='http://localhost:8080', placeholder='http://localhost:8080',
) )
gr.Markdown( 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>' '<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>'
) )
openAI_key = gr.Textbox( openAI_key = gr.Textbox(
label='Enter your OpenAI API key here', type='password' label='Enter your OpenAI API key here', type='password'

Loading…
Cancel
Save