File size: 823 Bytes
f8ccd9c
edd57c3
cab36bf
edd57c3
cab36bf
 
 
 
 
de8d8bf
cab36bf
de8d8bf
cab36bf
f8ccd9c
 
 
 
cab36bf
f8ccd9c
 
 
 
 
cab36bf
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from gradio_client import Client
import gradio as gr
import os

def check_password(username, password):
    if password == os.environ["ACCESS"]:
        return True
    else:
        return False

read_key = os.environ.get("HF_TOKEN", None)

if __name__ == "__main__":
    client = Client.duplicate("Nauryzbay/deckify_private", hf_token=read_key)

    func = lambda file, number_of_pages: client.predict(file, number_of_pages)

    with gr.Blocks() as demo:
        file = gr.File(label="Upload PDF")
        number_of_pages = gr.Number(label="Number of pages")
        output = gr.Textbox(label="Output")
        greet_btn = gr.Button("Generate slides")
        greet_btn.click(fn=func, inputs=[file, number_of_pages], outputs=output, api_name="greet")
    
    demo.queue(max_size=10)
    demo.launch(auth=check_password)