Staticaliza commited on
Commit
120bd05
1 Parent(s): d1595f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -20,7 +20,16 @@ for model_name, model_endpoint in API_ENDPOINTS.items():
20
  CHOICES.append(model_name)
21
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
22
 
23
- def predict(input, access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
 
 
 
 
 
 
 
 
 
24
 
25
  if (access_key != KEY):
26
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
@@ -53,11 +62,13 @@ def maintain_cloud():
53
 
54
  with gr.Blocks() as demo:
55
  with gr.Row(variant = "panel"):
56
- gr.Markdown("⚛️ This is a private LLM Space owned within STC Holdings!\n\n\nhttps://discord.gg/6JRtGawz7B")
57
 
58
  with gr.Row():
59
  with gr.Column():
60
- input = gr.Textbox(label = "Input", lines = 4)
 
 
61
  access_key = gr.Textbox(label = "Access Key", lines = 1)
62
  run = gr.Button("▶")
63
  cloud = gr.Button("☁️")
@@ -76,7 +87,7 @@ with gr.Blocks() as demo:
76
  with gr.Column():
77
  output = gr.Textbox(label = "Output", value = "", lines = 50)
78
 
79
- run.click(predict, inputs = [input, access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed], outputs = [output, input])
80
  cloud.click(maintain_cloud, inputs = [], outputs = [input, output])
81
 
82
  demo.queue(concurrency_count = 500, api_open = True).launch(show_api = True)
 
20
  CHOICES.append(model_name)
21
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
22
 
23
+ def format(input, chat_history, : str) -> str:
24
+ instructions = instructions.strip(" ").strip("\n")
25
+ prompt = instructions
26
+ for turn in chat_history:
27
+ user_message, bot_message = turn
28
+ prompt = f"{prompt}\n{USER_NAME}: {user_message}\n{BOT_NAME}: {bot_message}"
29
+ prompt = f"{prompt}\n{USER_NAME}: {message}\n{BOT_NAME}:"
30
+ return prompt
31
+
32
+ def predict(instruction, history, input, access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
33
 
34
  if (access_key != KEY):
35
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
 
62
 
63
  with gr.Blocks() as demo:
64
  with gr.Row(variant = "panel"):
65
+ gr.Markdown("🔯 This is a private LLM CHAT Space owned within STC Holdings!\n\n\nhttps://discord.gg/6JRtGawz7B")
66
 
67
  with gr.Row():
68
  with gr.Column():
69
+ history = gr.Chatbot(elem_id = "chatbot")
70
+ input = gr.Textbox(label = "Input", lines = 2)
71
+ instruction = gr.Textbox(label = "Instruction", lines = 4)
72
  access_key = gr.Textbox(label = "Access Key", lines = 1)
73
  run = gr.Button("▶")
74
  cloud = gr.Button("☁️")
 
87
  with gr.Column():
88
  output = gr.Textbox(label = "Output", value = "", lines = 50)
89
 
90
+ run.click(predict, inputs = [instruction, history, input, access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed], outputs = [output, input])
91
  cloud.click(maintain_cloud, inputs = [], outputs = [input, output])
92
 
93
  demo.queue(concurrency_count = 500, api_open = True).launch(show_api = True)