File size: 872 Bytes
5288f83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from utils.logger import setup_logger

logger = setup_logger(__name__)

class GradioInterface:
    def __init__(self, unified_system):
        self.unified_system = unified_system

    def create_interface(self):
        try:
            return gr.Interface(
                fn=self.unified_system.process_query,
                inputs=gr.Textbox(
                    label="Enter your query",
                    placeholder="e.g., 'Show me all T-shirts' or 'Describe the product features'"
                ),
                outputs=gr.Textbox(label="Response"),
                title="Unified Query Processing System",
                description="Enter a natural language query to search products or get descriptions."
            )
        except Exception as e:
            logger.error(f"Failed to create interface: {str(e)}")
            raise