Tonic commited on
Commit
c2ca11f
1 Parent(s): 65489db

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import gradio_client
3
+ from gradio_client import Client
4
+
5
+
6
+
7
+ def chat_api_interface(messages, model, frequency_penalty=0, logit_bias=None, max_tokens=None, n=1, presence_penalty=0, response_format="text", seed=None, stop=None, stream=False, temperature=1, top_p=1, tools=None, tool_choice="none", user=None):
8
+ # PASS
9
+ # PASS
10
+ return "API response here"
11
+
12
+ with gr.Blocks() as demo:
13
+ with gr.Row():
14
+ with gr.Column():
15
+ messages = gr.Textbox(label="Messages (JSON format)", placeholder="Enter messages as a JSON array")
16
+ model = gr.Textbox(label="Model ID", placeholder="Enter the model ID")
17
+ frequency_penalty = gr.Number(label="Frequency Penalty", value=0)
18
+ logit_bias = gr.Textbox(label="Logit Bias (JSON format)", placeholder="Enter logit bias as JSON")
19
+ max_tokens = gr.Number(label="Max Tokens", optional=True)
20
+ n = gr.Number(label="N", value=1)
21
+ presence_penalty = gr.Number(label="Presence Penalty", value=0)
22
+ response_format = gr.Radio(label="Response Format", choices=["text", "json_object"], value="text")
23
+ seed = gr.Number(label="Seed", optional=True)
24
+ stop = gr.Textbox(label="Stop Sequence(s)", placeholder="Enter stop sequences")
25
+ stream = gr.Checkbox(label="Stream", value=False)
26
+ temperature = gr.Slider(label="Temperature", minimum=0, maximum=2, value=1)
27
+ top_p = gr.Slider(label="Top P", minimum=0, maximum=1, value=1)
28
+ tools = gr.Textbox(label="Tools (JSON format)", optional=True, placeholder="Enter tools as JSON")
29
+ tool_choice = gr.Textbox(label="Tool Choice", value="none", placeholder="Enter tool choice")
30
+ user = gr.Textbox(label="User", optional=True, placeholder="Enter user identifier")
31
+
32
+ with gr.Column():
33
+ submit_btn = gr.Button("Submit")
34
+ output = gr.Textbox(label="API Response", readonly=True)
35
+
36
+ submit_btn.click(
37
+ chat_api_interface,
38
+ inputs=[messages, model, frequency_penalty, logit_bias, max_tokens, n, presence_penalty, response_format, seed, stop, stream, temperature, top_p, tools, tool_choice, user],
39
+ outputs=output
40
+ )
41
+
42
+ demo.launch()