File size: 647 Bytes
478cf05
 
 
346a47e
 
 
 
 
 
 
 
 
 
478cf05
346a47e
478cf05
1816df7
 
 
 
 
 
 
 
478cf05
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
26
import random
import gradio as gr

def response(message, history):
    if "吗?" in message:
        response_text_tmp = message.replace("吗?", "!")
        if "我" in response_text_tmp:
            response_text = response_text_tmp.replace("我", "你")
        else:
            response_text=response_text_tmp
    else:
        responses = ["I'm not sure.", "Interesting.", "Tell me more!"]
        response_text = random.choice(responses)

    return response_text




demo = gr.ChatInterface(
    response,
    title="Please Ask Me",
    description="Only the Yes-no question with 吗?, can I give u certain answer!",
)
demo.launch()