MohamedRashad commited on
Commit
13a1a55
·
verified ·
1 Parent(s): 1581f87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -14,6 +14,12 @@ tokenizer = AutoTokenizer.from_pretrained("Navid-AI/Yehia-7B-preview", token=os.
14
  model = AutoModelForCausalLM.from_pretrained("Navid-AI/Yehia-7B-preview", torch_dtype=torch.bfloat16, attn_implementation="flash_attention_2", token=os.getenv("HF_TOKEN")).to(device)
15
  streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
16
 
 
 
 
 
 
 
17
  @spaces.GPU
18
  def respond(
19
  message,
@@ -44,8 +50,7 @@ def respond(
44
  response += new_text
45
  yield response
46
 
47
-
48
- demo = gr.ChatInterface(
49
  respond,
50
  textbox=gr.Textbox(text_align="right", rtl=True, submit_btn=True, stop_btn=True),
51
  additional_inputs=[
@@ -55,7 +60,7 @@ demo = gr.ChatInterface(
55
  gr.Slider(minimum=0.0, maximum=1.0, value=0.6, step=0.1, label="Temperature"),
56
  gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.05, label="Repetition penalty"),
57
  ],
58
- example_labels=[["من الذى أكل الجبنة ؟"]],
59
  example_icons=[["💡"]],
60
  cache_examples=False,
61
  # head="<h1 style='text-align:center;'>Yehia 7B Preview</h1>",
@@ -69,6 +74,9 @@ demo = gr.ChatInterface(
69
  theme="JohnSmith9982/small_and_pretty",
70
  )
71
 
 
 
 
72
 
73
  if __name__ == "__main__":
74
- demo.launch()
 
14
  model = AutoModelForCausalLM.from_pretrained("Navid-AI/Yehia-7B-preview", torch_dtype=torch.bfloat16, attn_implementation="flash_attention_2", token=os.getenv("HF_TOKEN")).to(device)
15
  streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
16
 
17
+ HEADER = """<div style="text-align: center; margin-bottom: 20px;">
18
+ <h1>Yehia 7B Preview</h1>
19
+ <p style="font-size: 16px; color: #888;">How far can GRPO get you ?</p>
20
+ </div>
21
+ """
22
+
23
  @spaces.GPU
24
  def respond(
25
  message,
 
50
  response += new_text
51
  yield response
52
 
53
+ chat_interface = gr.ChatInterface(
 
54
  respond,
55
  textbox=gr.Textbox(text_align="right", rtl=True, submit_btn=True, stop_btn=True),
56
  additional_inputs=[
 
60
  gr.Slider(minimum=0.0, maximum=1.0, value=0.6, step=0.1, label="Temperature"),
61
  gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.05, label="Repetition penalty"),
62
  ],
63
+ examples=[["من الذى أكل الجبنة ؟"]],
64
  example_icons=[["💡"]],
65
  cache_examples=False,
66
  # head="<h1 style='text-align:center;'>Yehia 7B Preview</h1>",
 
74
  theme="JohnSmith9982/small_and_pretty",
75
  )
76
 
77
+ with gr.Blocks(fill_height=True) as demo:
78
+ gr.HTML(HEADER)
79
+ chat_interface.render()
80
 
81
  if __name__ == "__main__":
82
+ demo.queue().launch(ssr_mode=False)