Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,113 +100,6 @@ def run_command(command):
|
|
| 100 |
return f"Error: {e}"
|
| 101 |
|
| 102 |
|
| 103 |
-
with gr.Blocks(
|
| 104 |
-
title="3GPP Database",
|
| 105 |
-
theme="Base",
|
| 106 |
-
css=""".bigbox {
|
| 107 |
-
min-height:250px;
|
| 108 |
-
}"""
|
| 109 |
-
) as demo:
|
| 110 |
-
with gr.Tab("Matching"):
|
| 111 |
-
with gr.Accordion("Vector similarity"):
|
| 112 |
-
with gr.Row():
|
| 113 |
-
with gr.Column():
|
| 114 |
-
top_k = gr.Slider(1,
|
| 115 |
-
TOP_K_MAX,
|
| 116 |
-
value=TOP_K_DEFAULT,
|
| 117 |
-
step=1,
|
| 118 |
-
label="Vector similarity top_k",
|
| 119 |
-
interactive=True)
|
| 120 |
-
with gr.Column():
|
| 121 |
-
score = gr.Slider(0.01,
|
| 122 |
-
0.99,
|
| 123 |
-
value=SCORE_DEFAULT,
|
| 124 |
-
step=0.01,
|
| 125 |
-
label="Vector similarity score",
|
| 126 |
-
interactive=True)
|
| 127 |
-
|
| 128 |
-
with gr.Row():
|
| 129 |
-
with gr.Column(scale=10):
|
| 130 |
-
input_box = gr.Textbox(label="Input", placeholder="What are you looking for?")
|
| 131 |
-
with gr.Column(scale=1, min_width=BUTTON_MIN_WIDTH):
|
| 132 |
-
btn_run = gr.Button("Run", variant="primary")
|
| 133 |
-
|
| 134 |
-
output_box = gr.JSON(label="Output")
|
| 135 |
-
|
| 136 |
-
btn_run.click(fn=get_data,
|
| 137 |
-
inputs=[input_box, top_k, score, db_col_textbox, db_index_textbox],
|
| 138 |
-
outputs=[output_box])
|
| 139 |
-
|
| 140 |
-
with gr.Tab("Configuration"):
|
| 141 |
-
with gr.Row():
|
| 142 |
-
btn_init = gr.Button("Init")
|
| 143 |
-
|
| 144 |
-
load_emb = gr.Textbox("", label='Embedding Client', show_label=True)
|
| 145 |
-
load_col = gr.Textbox("", label='Milvus Collection', show_label=True)
|
| 146 |
-
|
| 147 |
-
with gr.Accordion("Embedding"):
|
| 148 |
-
|
| 149 |
-
with gr.Row():
|
| 150 |
-
with gr.Column():
|
| 151 |
-
emb_textbox = gr.Textbox(
|
| 152 |
-
label="Embedding Model",
|
| 153 |
-
value=EMBEDDING_MODEL,
|
| 154 |
-
placeholder="Paste Your Embedding Model Repo on HuggingFace",
|
| 155 |
-
lines=1,
|
| 156 |
-
interactive=True,
|
| 157 |
-
type='email')
|
| 158 |
-
|
| 159 |
-
with gr.Column():
|
| 160 |
-
emb_dropdown = gr.Dropdown(
|
| 161 |
-
EMBEDDING_LIST,
|
| 162 |
-
value=EMBEDDING_LOADER,
|
| 163 |
-
multiselect=False,
|
| 164 |
-
interactive=True,
|
| 165 |
-
label="Embedding Loader")
|
| 166 |
-
|
| 167 |
-
with gr.Accordion("Milvus Database"):
|
| 168 |
-
with gr.Row():
|
| 169 |
-
db_col_textbox = gr.Textbox(
|
| 170 |
-
label="Milvus Collection",
|
| 171 |
-
value=MILVUS_COLLECTION,
|
| 172 |
-
placeholder="Paste Your Milvus Collection (xx-xx-xx) and Hit ENTER",
|
| 173 |
-
lines=1,
|
| 174 |
-
interactive=True,
|
| 175 |
-
type='email')
|
| 176 |
-
db_index_textbox = gr.Textbox(
|
| 177 |
-
label="Milvus Host",
|
| 178 |
-
value=MILVUS_HOST,
|
| 179 |
-
placeholder="Paste Your Milvus Index (xxxx) and Hit ENTER",
|
| 180 |
-
lines=1,
|
| 181 |
-
interactive=True,
|
| 182 |
-
type='password')
|
| 183 |
-
|
| 184 |
-
with gr.Tab("Command Output Viewer"):
|
| 185 |
-
with gr.Row():
|
| 186 |
-
cmd_input = gr.Textbox(label="Command", placeholder="Enter a command")
|
| 187 |
-
cmd_btn_run = gr.Button("Run", variant="primary")
|
| 188 |
-
cmd_output = gr.Textbox(label="Output", placeholder="Command output will be displayed here", readonly=True)
|
| 189 |
-
|
| 190 |
-
cmd_iface = gr.Interface(
|
| 191 |
-
fn=run_command,
|
| 192 |
-
inputs="text",
|
| 193 |
-
outputs="text",
|
| 194 |
-
title="Command Output Viewer",
|
| 195 |
-
description="Enter a command and view its output.",
|
| 196 |
-
examples=[
|
| 197 |
-
["ls"],
|
| 198 |
-
["pwd"],
|
| 199 |
-
["echo 'Hello, Gradio!'"],
|
| 200 |
-
["python --version"]]
|
| 201 |
-
)
|
| 202 |
-
|
| 203 |
-
cmd_btn_run.click(fn=cmd_iface.launch, inputs=[cmd_input], outputs=[cmd_output])
|
| 204 |
-
|
| 205 |
-
if __name__ == "__main__":
|
| 206 |
-
demo.queue()
|
| 207 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 208 |
-
|
| 209 |
-
'''
|
| 210 |
with gr.Blocks(
|
| 211 |
title = "3GPP Database",
|
| 212 |
theme = "Base",
|
|
@@ -303,4 +196,3 @@ if __name__ == "__main__":
|
|
| 303 |
demo.launch(server_name="0.0.0.0",
|
| 304 |
server_port=7860)
|
| 305 |
|
| 306 |
-
'''
|
|
|
|
| 100 |
return f"Error: {e}"
|
| 101 |
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
with gr.Blocks(
|
| 104 |
title = "3GPP Database",
|
| 105 |
theme = "Base",
|
|
|
|
| 196 |
demo.launch(server_name="0.0.0.0",
|
| 197 |
server_port=7860)
|
| 198 |
|
|
|