triphuong57 commited on
Commit
04de766
·
verified ·
1 Parent(s): ad33b28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -8,10 +8,10 @@ import os
8
  token = os.getenv('token')
9
  HfFolder.save_token(token)
10
  device = "cuda"
11
- model = PaliGemmaForConditionalGeneration.from_pretrained("triphuong57/paligemma_lora")
12
  processor = AutoProcessor.from_pretrained("google/paligemma-3b-mix-224")
13
 
14
- @spaces.GPU(duration=240)
15
  def greet(image, prompt):
16
 
17
 
@@ -26,5 +26,7 @@ def greet(image, prompt):
26
  decoded = processor.decode(generation[0][input_len:], skip_special_tokens=True)
27
  return decoded
28
 
29
- demo = gr.Interface(fn=greet, inputs=[gr.Image(label="Upload image", sources=['upload', 'webcam'], type="pil"), gr.Text()], outputs="text")
 
 
30
  demo.launch(share=True)
 
8
  token = os.getenv('token')
9
  HfFolder.save_token(token)
10
  device = "cuda"
11
+ model = PaliGemmaForConditionalGeneration.from_pretrained("triphuong57/paligemma_lora").to(device)
12
  processor = AutoProcessor.from_pretrained("google/paligemma-3b-mix-224")
13
 
14
+ @spaces.GPU(duration=180)
15
  def greet(image, prompt):
16
 
17
 
 
26
  decoded = processor.decode(generation[0][input_len:], skip_special_tokens=True)
27
  return decoded
28
 
29
+ title = "Demo BTL nhóm 8"
30
+ description = "Made by Nguyễn Quý Đang, Đỗ Minh Nhật, Vũ Vân Long"
31
+ demo = gr.Interface(fn=greet, inputs=[gr.Image(label="Upload image", sources=['upload', 'webcam'], type="pil"), gr.Text()], outputs="text", title=title, description=description)
32
  demo.launch(share=True)