File size: 1,157 Bytes
be6deff
834978e
be6deff
b855d19
 
 
 
 
 
 
 
834978e
 
 
 
0dac1b8
 
 
 
 
834978e
 
b855d19
0dac1b8
cf70e4a
f44bf4c
 
d040a6e
 
 
 
 
f44bf4c
b855d19
f44bf4c
 
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
33
34
35
36
37
import gradio as gr
import subprocess

def greet(name1, name2, name3, name4, name5):
    # Storing each input in a variable, you can process or save them as you like
    str1 = name1
    str2 = name2
    str3 = name3
    str4 = name4
    str5 = name5
    
    # Construct the command
    command = f"poetry run runoak set-apikey -e openai {str1}"
    
    # Execute the command
    result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

    # Save the output to a string
    output_string = result.stdout
    error_string = result.stderr


    # For the purpose of this example, I'm just returning the values concatenated
    return f"Inputs received: {str1}, {str2}, {str3}, {str4}, {str5}, {output_string},{error_string}"

# Define 5 text input boxes with labels
input_boxes = [
    gr.inputs.Textbox(label="openai api key"),
    gr.inputs.Textbox(label="bioportal api key"),
    gr.inputs.Textbox(label="NCBI api key"),
    gr.inputs.Textbox(label="HuggingFace Hub api key"),
    gr.inputs.Textbox(label="Input data"),
]

iface = gr.Interface(fn=greet, inputs=input_boxes, outputs="text")
iface.launch()