mrhat79 commited on
Commit
a797c51
·
verified ·
1 Parent(s): e37af50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -8
app.py CHANGED
@@ -1,9 +1,6 @@
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
 
@@ -35,14 +32,78 @@ 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
  """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
  demo = gr.ChatInterface(
47
  respond,
48
  additional_inputs=[
@@ -57,8 +118,8 @@ demo = gr.ChatInterface(
57
  label="Top-p (nucleus sampling)",
58
  ),
59
  ],
 
60
  )
61
 
62
-
63
  if __name__ == "__main__":
64
- demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
 
 
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
6
 
 
32
  top_p=top_p,
33
  ):
34
  token = message.choices[0].delta.content
 
35
  response += token
36
  yield response
37
 
38
 
39
+ # Custom CSS for 16k quality black and white transparent RGB colors
40
+ css = """
41
+ .gradio-container {
42
+ background: rgba(0, 0, 0, 0.9); /* Black background with transparency */
43
+ color: white;
44
+ font-family: Arial, sans-serif;
45
+ }
46
+
47
+ .gradio-input, .gradio-output {
48
+ background: rgba(255, 255, 255, 0.1); /* Transparent white background */
49
+ border: 2px solid rgba(255, 255, 255, 0.3); /* Light white border */
50
+ border-radius: 10px;
51
+ color: white;
52
+ }
53
+
54
+ .gradio-input:focus, .gradio-output:focus {
55
+ border-color: rgba(255, 255, 255, 0.6); /* Focus effect */
56
+ }
57
+
58
+ .gradio-textbox {
59
+ color: rgb(255, 255, 255); /* Text color */
60
+ background-color: rgba(0, 0, 0, 0.5); /* Dark background for the textbox */
61
+ }
62
+
63
+ .gradio-slider .slider {
64
+ background: rgba(255, 255, 255, 0.4); /* Transparent slider background */
65
+ color: rgb(255, 255, 255); /* Slider color */
66
+ }
67
+
68
+ .gradio-button {
69
+ background-color: rgb(0, 0, 0); /* Black button */
70
+ color: rgb(255, 255, 255); /* White text */
71
+ border-radius: 8px;
72
+ }
73
+
74
+ .gradio-button:hover {
75
+ background-color: rgb(80, 80, 80); /* Darker on hover */
76
+ }
77
+
78
+ .gradio-interface {
79
+ border: 2px solid rgba(255, 255, 255, 0.3); /* Light border */
80
+ }
81
+
82
+ .gradio-header {
83
+ color: rgb(255, 255, 255); /* Header text color */
84
+ font-size: 24px;
85
+ }
86
+
87
+ .gradio-footer {
88
+ color: rgba(255, 255, 255, 0.5); /* Footer text color */
89
+ }
90
+
91
+ /* Chatbox customization */
92
+ .chatbox .gradio-output {
93
+ padding: 10px;
94
+ border-radius: 15px;
95
+ background: rgba(0, 0, 0, 0.8); /* Dark chat background */
96
+ color: rgba(255, 255, 255, 0.9); /* Light text */
97
+ }
98
+
99
+ .chatbox .gradio-input {
100
+ padding: 10px;
101
+ border-radius: 15px;
102
+ background: rgba(255, 255, 255, 0.1); /* Transparent input box */
103
+ color: rgba(255, 255, 255, 0.9);
104
+ }
105
  """
106
+
 
107
  demo = gr.ChatInterface(
108
  respond,
109
  additional_inputs=[
 
118
  label="Top-p (nucleus sampling)",
119
  ),
120
  ],
121
+ css=css # Add custom CSS
122
  )
123
 
 
124
  if __name__ == "__main__":
125
+ demo.launch()