File size: 2,044 Bytes
3ebb93c
ed79e96
 
 
96398c2
 
01911c9
2fcf433
 
 
 
d21d723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24fca26
1d67050
01911c9
24fca26
 
 
01911c9
24fca26
 
 
01911c9
 
 
 
d21d723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed79e96
 
24fca26
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import random
import gradio as gr
from huggingface_hub import InferenceClient

def random_response(message, history):
    return random.choice(["Yes", "No"])

with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")) as demo: # Using Soft theme with adjusted hues for a refined look
    gr.HTML("""<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fzelk12%2FChat_interface_test">
               <img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fzelk12%2FChat_interface_test&countColor=%23263759" />
               </a>""")

    with gr.Accordion(
      "API",
       open=False,
    ):
      with gr.Row():
        gr.Textbox(
          label="API key",
          scale=4,
        )
        gr.Button(
          value="Apply",
          scale=1,
        )
      gr.Dropdown(label="Choose provider")
  
    gr.ChatInterface(random_response, 
                    multimodal=True,
                    chatbot=gr.Chatbot(
                      label="output",
                    ),
                    type="messages",
                    textbox=gr.MultimodalTextbox(
                      label="input",
                    ),
                    editable=True,
                    title="Chat interface test",
                    save_history=True,
                    )
    with gr.Accordion(
      "Settings",
       open=False,
    ):
      gr.Dropdown(label="Choose model")
      gr.Textbox(label="System instructions",)
      gr.Slider(label="temperature",
                interactive=True,
               minimum=0,
               maximum=2,
               value=0.95)
      gr.Slider(label="topP",
                interactive=True,
                minimum=0,
                maximum=1,
                value=0.5)
      gr.Slider(label="topK",
                interactive=True,
               value=100)
      gr.Checkbox(
        label="Enable output stream"
      )

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