nileshhanotia commited on
Commit
5288f83
·
verified ·
1 Parent(s): af3dbe5

Create gradio_interface.py

Browse files
Files changed (1) hide show
  1. gradio_interface.py +24 -0
gradio_interface.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from utils.logger import setup_logger
3
+
4
+ logger = setup_logger(__name__)
5
+
6
+ class GradioInterface:
7
+ def __init__(self, unified_system):
8
+ self.unified_system = unified_system
9
+
10
+ def create_interface(self):
11
+ try:
12
+ return gr.Interface(
13
+ fn=self.unified_system.process_query,
14
+ inputs=gr.Textbox(
15
+ label="Enter your query",
16
+ placeholder="e.g., 'Show me all T-shirts' or 'Describe the product features'"
17
+ ),
18
+ outputs=gr.Textbox(label="Response"),
19
+ title="Unified Query Processing System",
20
+ description="Enter a natural language query to search products or get descriptions."
21
+ )
22
+ except Exception as e:
23
+ logger.error(f"Failed to create interface: {str(e)}")
24
+ raise