File size: 1,044 Bytes
5f188d3
7e8e8de
5f188d3
 
95c63c6
 
 
ce85bb5
95c63c6
ce85bb5
95c63c6
 
 
 
 
 
106084f
 
 
e122adc
106084f
5f188d3
95c63c6
 
 
 
 
 
 
7777ea4
d22981b
ce85bb5
95c63c6
5f188d3
 
 
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
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
from gradio_client import Client

def random_response(message, history):
    # Creating a persistent chat session with history for each user chat.
    client = Client("TejAndrewsACC/Z3taACC-Plus")
    
    # Make API call to chat with message
    result = client.predict(
        message=message,  # Removed history from here
        max_tokens=2048,
        temperature=0.7,
        top_p=0.95,
        api_name="/chat"
    )
    
    # Format response as a dictionary
    response = {"text": result}
    
    # Return the response and updated history as a dictionary
    return response, history + [(message, response)]  # Append the current message and response to history

# Set up Gradio chat interface
demo = gr.ChatInterface(
    fn=random_response, 
    type="messages", 
    autofocus=False, 
    save_history=True, 
    show_progress="full",
    flagging_mode="manual",
    editable=True,
    theme="TejAndrewsACC/zetaofficalthemeacc"  # Make sure this theme exists
)

if __name__ == "__main__":
    demo.launch()