naourpally commited on
Commit
807df8d
·
1 Parent(s): efd2301

Submit buttom styling, clear chat and add a header

Browse files
Files changed (1) hide show
  1. app.py +34 -8
app.py CHANGED
@@ -13,21 +13,47 @@ def get_text_response(prompt):
13
  text_response = response_json.get("response", "No response received.")
14
  return text_response
15
 
16
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  with gr.Row():
18
  prompt = gr.Textbox(label="Enter your prompt")
19
  submit_button = gr.Button("Submit")
 
20
  output = gr.Textbox(label="Response")
21
 
22
  submit_button.click(fn=get_text_response, inputs=prompt, outputs=output)
23
-
24
- # Adding the acknowledgment about Fair Compute
25
- gr.HTML(
 
 
 
26
  """
27
- <div class="acknowledgments">
28
- <p>Run AI models on your home computers, powered by <a href="https://faircompute.com/" style="text-decoration: underline;" target="_blank">FairCompute</a></p>
29
- </div>
30
- """
31
  )
32
 
33
  demo.launch()
 
13
  text_response = response_json.get("response", "No response received.")
14
  return text_response
15
 
16
+ def clear_chat():
17
+ return "", ""
18
+
19
+ css = """
20
+ <style>
21
+ .header-title {
22
+ font-size: 1.5em;
23
+ margin-bottom: 20px;
24
+ text-align: center;
25
+ }
26
+ .gr-button {
27
+ background-color: #7D3C98; /* Placeholder for the purple color, replace with actual color code */
28
+ color: white;
29
+ }
30
+ .gr-button:hover {
31
+ background-color: #6C3483; /* Darker purple on hover, replace with actual color code */
32
+ }
33
+ .acknowledgments {
34
+ margin-top: 20px;
35
+ text-align: center;
36
+ }
37
+ </style>
38
+ """
39
+
40
+ with gr.Blocks(css=css) as demo:
41
+ gr.Markdown("<div class='header-title'>Fair Compute Llama-2 Chat</div>")
42
+
43
  with gr.Row():
44
  prompt = gr.Textbox(label="Enter your prompt")
45
  submit_button = gr.Button("Submit")
46
+ clear_button = gr.Button("Clear")
47
  output = gr.Textbox(label="Response")
48
 
49
  submit_button.click(fn=get_text_response, inputs=prompt, outputs=output)
50
+ clear_button.click(fn=clear_chat, inputs=[], outputs=[prompt, output])
51
+ gr.Markdown(
52
+ """
53
+ <div class="acknowledgments">
54
+ <p>Run AI models on your home computers, powered by <a href="https://faircompute.com/" style="text-decoration: underline;" target="_blank">FairCompute</a></p>
55
+ </div>
56
  """
 
 
 
 
57
  )
58
 
59
  demo.launch()