arad1367 commited on
Commit
238ce74
β€’
1 Parent(s): d18942e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -20,7 +20,6 @@ PLACEHOLDER = """
20
  </center>
21
  """
22
 
23
-
24
  CSS = """
25
  .duplicate-button {
26
  margin: auto !important;
@@ -39,7 +38,7 @@ quantization_config = BitsAndBytesConfig(
39
  load_in_4bit=True,
40
  bnb_4bit_compute_dtype=torch.bfloat16,
41
  bnb_4bit_use_double_quant=True,
42
- bnb_4bit_quant_type= "nf4")
43
 
44
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
45
  model = AutoModelForCausalLM.from_pretrained(
@@ -100,8 +99,19 @@ def stream_chat(
100
 
101
  chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
102
 
 
 
 
 
 
 
 
 
 
 
103
  with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
104
  gr.HTML(TITLE)
 
105
  gr.ChatInterface(
106
  fn=stream_chat,
107
  chatbot=chatbot,
@@ -162,7 +172,8 @@ with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
162
  ],
163
  cache_examples=False,
164
  )
 
165
 
166
 
167
  if __name__ == "__main__":
168
- demo.launch()
 
20
  </center>
21
  """
22
 
 
23
  CSS = """
24
  .duplicate-button {
25
  margin: auto !important;
 
38
  load_in_4bit=True,
39
  bnb_4bit_compute_dtype=torch.bfloat16,
40
  bnb_4bit_use_double_quant=True,
41
+ bnb_4bit_quant_type="nf4")
42
 
43
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
44
  model = AutoModelForCausalLM.from_pretrained(
 
99
 
100
  chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
101
 
102
+ footer = """
103
+ <div style="text-align: center; margin-top: 20px;">
104
+ <a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
105
+ <a href="https://github.com/arad1367" target="_blank">GitHub</a> |
106
+ <a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a>
107
+ <br>
108
+ Made with πŸ’– by Pejman Ebrahimi
109
+ </div>
110
+ """
111
+
112
  with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
113
  gr.HTML(TITLE)
114
+ gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button")
115
  gr.ChatInterface(
116
  fn=stream_chat,
117
  chatbot=chatbot,
 
172
  ],
173
  cache_examples=False,
174
  )
175
+ gr.HTML(footer)
176
 
177
 
178
  if __name__ == "__main__":
179
+ demo.launch()