Skip to content

Commit 09acd8a

Browse files
committed
make deployed version work
1 parent 38d6f90 commit 09acd8a

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed
Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
from zenml import step
21
import 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)

0 commit comments

Comments
 (0)