File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed
Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 1- from zenml import step
21import time
3- import gradio as gr
42
3+ import gradio as gr
4+ from utils .llm_utils import process_input_with_retrieval
5+ from zenml import step
56
6- def slow_echo (message , history ):
7- for i in range (len (message )):
8- time .sleep (0.05 )
9- yield "You typed: " + message [: i + 1 ]
107
8+ def predict (message , history ):
9+ return process_input_with_retrieval (
10+ input = message ,
11+ n_items_retrieved = 5 ,
12+ use_reranking = False ,
13+ )
1114
1215
1316@step
14- def gradio_rag_deployment ():
15- demo = gr .ChatInterface (slow_echo , type = "messages" )
16- demo .launch ()
17+ def gradio_rag_deployment () -> None :
18+ """Launches a Gradio chat interface with the slow echo demo.
19+
20+ Starts a web server with a chat interface that echoes back user messages.
21+ The server runs indefinitely until manually stopped.
22+ """
23+ demo = gr .ChatInterface (predict , type = "messages" )
24+ demo .launch (share = True , inbrowser = True )
25+ # Keep the step running
26+ while True :
27+ time .sleep (1 )
You can’t perform that action at this time.
0 commit comments