Antonela Tamagnini commited on
Commit
bc48769
·
unverified ·
1 Parent(s): 3907f81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -19
app.py CHANGED
@@ -1,12 +1,10 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
- """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
-
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
@@ -35,35 +33,43 @@ def respond(
35
  top_p=top_p,
36
  ):
37
  token = message.choices[0].delta.content
38
-
39
  response += token
40
  yield response
41
 
42
- """
43
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
- """
45
-
46
- # Custom CSS for changing the color scheme and adding a logo
47
  custom_css = """
48
- #component-1 {
49
- background-color: #f0f8ff; /* Light blue background */
50
- border-radius: 10px; /* Rounded corners for the input components */
51
- padding: 10px;
52
  }
53
 
54
- #component-1 h1 {
55
- display: inline-block;
56
- margin: 0;
57
  }
58
 
59
  #header {
60
  display: flex;
61
  align-items: center;
62
  justify-content: space-between;
 
63
  }
64
 
65
  #logo {
66
- height: 50px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
  """
69
 
@@ -86,6 +92,5 @@ demo = gr.ChatInterface(
86
  css=custom_css
87
  )
88
 
89
-
90
  if __name__ == "__main__":
91
  demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Initialize the InferenceClient
 
 
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
+ # Define the response function
8
  def respond(
9
  message,
10
  history: list[tuple[str, str]],
 
33
  top_p=top_p,
34
  ):
35
  token = message.choices[0].delta.content
 
36
  response += token
37
  yield response
38
 
39
+ # Custom CSS for global styling
 
 
 
 
40
  custom_css = """
41
+ body {
42
+ background-color: #f0f8ff; /* Light blue background for the whole interface */
 
 
43
  }
44
 
45
+ .gradio-container {
46
+ border-radius: 10px; /* Rounded corners for the whole Gradio interface */
47
+ padding: 20px;
48
  }
49
 
50
  #header {
51
  display: flex;
52
  align-items: center;
53
  justify-content: space-between;
54
+ margin-bottom: 20px; /* Adds space below the header */
55
  }
56
 
57
  #logo {
58
+ height: 50px; /* Logo size */
59
+ }
60
+
61
+ .gr-button {
62
+ background-color: #007bff !important; /* Custom color for buttons */
63
+ color: white !important;
64
+ border-radius: 5px !important;
65
+ }
66
+
67
+ .gr-slider {
68
+ color: #007bff !important; /* Custom color for slider handles */
69
+ }
70
+
71
+ .gr-textbox {
72
+ border-color: #007bff !important; /* Custom border color for textboxes */
73
  }
74
  """
75
 
 
92
  css=custom_css
93
  )
94
 
 
95
  if __name__ == "__main__":
96
  demo.launch()