Spaces:
Sleeping
Sleeping
gamingflexer
commited on
Commit
·
ca7de80
1
Parent(s):
6cadae0
Add Gradio interface to app.py
Browse files- src/app.py +31 -0
src/app.py
CHANGED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from config import OPENAI_API_KEY
|
2 |
+
import gradio as gr
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
def sample_fun(first_image,voice_input, text_input):
|
6 |
+
return
|
7 |
+
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
|
10 |
+
with gr.Tab("Add Your Image"):
|
11 |
+
with gr.Row():
|
12 |
+
first_image = gr.Image(label="Upload Image")
|
13 |
+
voice_input = gr.Audio(label="Upload Audio")
|
14 |
+
text_input = gr.Textbox(label="Enter Text")
|
15 |
+
submit_button_tab_1 = gr.Button("Start")
|
16 |
+
with gr.Row():
|
17 |
+
dataframe_output = gr.Dataframe(headers=['title','des','price'])
|
18 |
+
|
19 |
+
with gr.Tab("Search Catalog"):
|
20 |
+
with gr.Row():
|
21 |
+
embbed_text_search = gr.Textbox(label="Enter Text")
|
22 |
+
with gr.Row():
|
23 |
+
top_k = gr.Number(label="Number of results - Min 2")
|
24 |
+
with gr.Row():
|
25 |
+
submit_button_tab_4 = gr.Button("Start")
|
26 |
+
dataframe_output_tab_4 = gr.Dataframe(headers=['ID', 'Distance', 'Title', 'Authors', 'Source'])
|
27 |
+
|
28 |
+
submit_button_tab_1.click(fn=sample_fun,inputs=[first_image,voice_input, text_input] ,outputs= dataframe_output)
|
29 |
+
submit_button_tab_4.click(fn=sample_fun,inputs=[embbed_text_search, top_k] ,outputs= dataframe_output_tab_4)
|
30 |
+
|
31 |
+
demo.launch(server_name="0.0.0.0",server_port=9002)
|