Spaces:
Runtime error
Runtime error
gamingflexer
commited on
Commit
·
502e4ca
1
Parent(s):
f296ede
gradio app added
Browse files- src/app.py +8 -16
src/app.py
CHANGED
|
@@ -1,31 +1,23 @@
|
|
| 1 |
-
from module.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
|
| 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 |
-
|
| 27 |
|
| 28 |
-
submit_button_tab_1.click(fn=sample_fun,inputs=[
|
| 29 |
-
submit_button_tab_4.click(fn=sample_fun,inputs=[embbed_text_search
|
| 30 |
|
| 31 |
-
demo.launch(server_name="0.0.0.0",server_port=
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
def sample_fun(first_image,voice_input, text_input):
|
| 4 |
return
|
| 5 |
|
| 6 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue=gr.themes.colors.red, secondary_hue=gr.themes.colors.pink)) as demo:
|
| 7 |
|
| 8 |
with gr.Tab("Add Your Image"):
|
| 9 |
+
voice_input = gr.Audio(label="Upload Audio")
|
| 10 |
+
prodcut_id = gr.Textbox(label="Enter Product ID")
|
| 11 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
| 12 |
submit_button_tab_1 = gr.Button("Start")
|
|
|
|
|
|
|
| 13 |
|
| 14 |
with gr.Tab("Search Catalog"):
|
| 15 |
with gr.Row():
|
| 16 |
+
embbed_text_search = gr.Textbox(label="Enter Product Name")
|
|
|
|
|
|
|
|
|
|
| 17 |
submit_button_tab_4 = gr.Button("Start")
|
| 18 |
+
dataframe_output_tab_4 = gr.Dataframe(headers=['ID', 'Distance', 'Title', 'Authors', 'Source'])
|
| 19 |
|
| 20 |
+
submit_button_tab_1.click(fn=sample_fun,inputs=[voice_input,prodcut_id])
|
| 21 |
+
submit_button_tab_4.click(fn=sample_fun,inputs=[embbed_text_search] ,outputs= dataframe_output_tab_4)
|
| 22 |
|
| 23 |
+
demo.launch(server_name="0.0.0.0",server_port=9003)
|