File size: 1,446 Bytes
d6bd8fe
8e7cdd3
 
 
 
d6bd8fe
 
 
 
 
8e7cdd3
 
 
 
812e873
8e7cdd3
 
 
 
 
 
 
 
 
 
 
 
d6bd8fe
812e873
8e7cdd3
 
d6bd8fe
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
27
28
29
30
31
32
import gradio as gr
import pixel_encrypt as pe
from diff import SendIt as si 
go=si()
models = go.models

with gr.Blocks() as app:
    with gr.Row():
        gr.Column()
        with gr.Column():
            with gr.Row():
                with gr.Tab("Encrypt"):
                    rsa_to_enc = gr.Textbox(label="Message to Encrypt",lines=3)
                    pub_key_in = gr.Image(label="Public Key", type="filepath")
                    priv_key_in = gr.Image(label="Private Key(sig)", type="filepath")
                    rsa_enc_btn = gr.Button("RSA Encrypt")
                    rsa_enc_mes = gr.Textbox(label="encoded", max_lines=4)
                    qr_enc_mes = gr.Image(type="filepath")
                with gr.Tab("Custom"):
                    with gr.Group():
                        with gr.Column():
                            inp=gr.Textbox(label="Prompt")
                            model=gr.Dropdown(type='index',choices=[m for m in models], value=models[5])
                            cnt = gr.Slider(minimum=1,maximum=4,step=1,value=1)                    
                            diff_btn = gr.Button()
                    diff_im = gr.Gallery()
                    im_choice=gr.Image(label='Place image here',type='filepath')
        gr.Column()
    rsa_enc_btn.click(pe.encrypt_text,[rsa_to_enc,pub_key_in,priv_key_in],[rsa_enc_mes,qr_enc_mes])
    diff_btn.click(go.send_it,[inp,model,cnt],diff_im)

app.launch()