qspacecorp commited on
Commit
e070814
·
verified ·
1 Parent(s): 4591759

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -44
app.py CHANGED
@@ -6,7 +6,6 @@ For more information on `huggingface_hub` Inference API support, please check th
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
-
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
@@ -42,50 +41,41 @@ def respond(
42
  """
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
- # JavaScript to hide the additional inputs section
46
- js = """
47
- <script>
48
- document.addEventListener("DOMContentLoaded", function() {
49
- const additionalInputs = document.querySelector('.additional-inputs-container');
50
- if (additionalInputs) {
51
- additionalInputs.style.display = 'none';
52
- }
53
- });
54
- </script>
55
- """
56
-
57
- # Define the layout of the interface, including the JS script
58
- def create_layout():
59
- return f"""
60
- <head>
61
- <style>
62
- /* Any additional styles can go here */
63
- </style>
64
- </head>
65
- <body>
66
- {js}
67
- <div id="main-interface"></div>
68
- </body>
69
- """
70
 
71
- # Create the Gradio interface with a custom layout
72
- with gr.Blocks() as demo:
73
- gr.HTML(create_layout())
74
- gr.ChatInterface(
75
- respond,
76
- additional_inputs=[
77
- gr.Textbox(value="You are a friendly Chatbot. your default language is the user language. your name is Maya. developer from Qspace Corporation, a small project whit 10 teenagers. Qspace isn't a registred company. it is founded 11 July 2022 in Martellago (Ve) in Italy. ", label="System message"),
78
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
79
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
80
- gr.Slider(
81
- minimum=0.1,
82
- maximum=1.0,
83
- value=0.95,
84
- step=0.05,
85
- label="Top-p (nucleus sampling)",
86
- ),
87
- ],
88
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  if __name__ == "__main__":
91
  demo.launch()
 
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
 
9
  def respond(
10
  message,
11
  history: list[tuple[str, str]],
 
41
  """
42
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
43
  """
44
+ demo = gr.ChatInterface(
45
+ respond,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ additional_inputs=[
48
+ gr.Textbox(
49
+ value="You are a friendly Chatbot. your default language is the user language. your name is Maya. developer from Qspace Corporation, a small project whit 10 teenagers. Qspace isn't a registred company. it is founded 11 July 2022 in Martellago (Ve) in Italy. ",
50
+ label="System message",
51
+ visible=False
52
+ ),
53
+ gr.Slider(
54
+ minimum=1,
55
+ maximum=2048,
56
+ value=512,
57
+ step=1,
58
+ label="Max new tokens",
59
+ visible=False
60
+ ),
61
+ gr.Slider(
62
+ minimum=0.1,
63
+ maximum=4.0,
64
+ value=0.7,
65
+ step=0.1,
66
+ label="Temperature",
67
+ visible=False
68
+ ),
69
+ gr.Slider(
70
+ minimum=0.1,
71
+ maximum=1.0,
72
+ value=0.95,
73
+ step=0.05,
74
+ label="Top-p (nucleus sampling)",
75
+ visible=False
76
+ ),
77
+ ],
78
+ )
79
 
80
  if __name__ == "__main__":
81
  demo.launch()