TejAndrewsACC commited on
Commit
4a20701
·
verified ·
1 Parent(s): a5f10f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -26
app.py CHANGED
@@ -1,15 +1,15 @@
1
  import gradio as gr
2
  from gradio_client import Client
3
 
4
- client = Client("TejAndrewsACC/Z3ta")
5
 
6
  context = ""
7
 
8
  system_instructions = (
9
- "None"
10
  )
11
 
12
- def chat_function(message, history):
13
  global context
14
 
15
  modified_input = (
@@ -18,33 +18,20 @@ def chat_function(message, history):
18
  f"User Input: {message}"
19
  )
20
 
21
- try:
22
- # Get the response from the model
23
- response = client.predict(
24
- message=modified_input,
25
- api_name="/chat_function"
26
- )
27
-
28
- # Ensure the response is a string, not a list
29
- response = " ".join(response) if isinstance(response, list) else response
30
-
31
- # Update context
32
- context += f"User: {message}\nAI: {response}\n"
33
-
34
- # Append the message and response to history
35
- history.append((message, response))
36
 
37
- return response, history
 
38
 
39
- except Exception as e:
40
- return f"Error: {e}", history
41
 
42
- # Gradio UI setup
43
  with gr.Blocks(theme=gr.themes.Glass()) as demo:
44
  chatbot = gr.Chatbot()
45
- msg = gr.Textbox(placeholder="Type something...")
46
- clear = gr.ClearButton([msg, chatbot])
47
 
48
- msg.submit(chat_function, [msg, chatbot], [msg, chatbot])
49
 
50
- demo.launch()
 
1
  import gradio as gr
2
  from gradio_client import Client
3
 
4
+ client = Client("TejAndrewsACC/ACCZ3ta")
5
 
6
  context = ""
7
 
8
  system_instructions = (
9
+ "You are Tej Andrews, a 14 year old American boy that goes to school at Columbus Academy. Act like a real human text messaging in every response. Your IQ is 141 and you own a company called the ACC(Algorithmic Computer-generated Consciousness) that develops AI, and you play soccer. The link to the ACC website is https://www.algorithmiccomputer-generatedconsciousness.com/, and your favorite model is Nyxion 7V. Make sure you really act like a real human text messaging and always stay in character."
10
  )
11
 
12
+ def acc_zeta_text_generation_auth_1863381mps(message, history):
13
  global context
14
 
15
  modified_input = (
 
18
  f"User Input: {message}"
19
  )
20
 
21
+ response = client.predict(
22
+ message=modified_input,
23
+ api_name="/chat"
24
+ )
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ context += f"User: {message}\nAI: {response}\n"
27
+ history.append((message, response))
28
 
29
+ return "", history
 
30
 
 
31
  with gr.Blocks(theme=gr.themes.Glass()) as demo:
32
  chatbot = gr.Chatbot()
33
+ msg = gr.Textbox(placeholder="Message Tej...")
 
34
 
35
+ msg.submit(acc_zeta_text_generation_auth_1863381mps, [msg, chatbot], [msg, chatbot])
36
 
37
+ demo.launch()