sitammeur commited on
Commit
429e493
·
verified ·
1 Parent(s): 1790ec9

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -58
app.py DELETED
@@ -1,58 +0,0 @@
1
- # Importing the requirements
2
- import warnings
3
- warnings.filterwarnings("ignore")
4
-
5
- import gradio as gr
6
- from src.app.response import caption_image
7
-
8
-
9
- # Image and input parameters
10
- image = gr.Image(type="pil", label="Image")
11
- max_new_tokens = gr.Slider(
12
- minimum=20,
13
- maximum=160,
14
- value=80,
15
- step=10,
16
- label="Max Tokens",
17
- info="Use larger values for detailed captions",
18
- )
19
- language = gr.Dropdown(
20
- choices=["English", "Spanish", "French"],
21
- value="English",
22
- label="Language",
23
- info="Select the caption language",
24
- interactive=True,
25
- )
26
- sampling = gr.Checkbox(value=False, label="Sampling")
27
-
28
- # Output for the interface
29
- answer = gr.Textbox(label="Generated Caption", show_label=True, show_copy_button=True)
30
-
31
- # Examples for the interface
32
- examples = [
33
- ["images/cat.jpg", 100, "Spanish", False],
34
- ["images/dog.jpg", 80, "English", True],
35
- ["images/bird.jpg", 160, "French", False],
36
- ]
37
-
38
- # Title, description, and article for the interface
39
- title = "PaliGemma 2 Image Captioning"
40
- description = "Gradio Demo for the PaliGemma 2 Vision Language Understanding and Generation model. This model generates natural language captions based on uploaded images. To use it, upload your image, select the desired parameters (or stick with the default settings), and click 'Submit.' You can also choose one of the examples to load a predefined image. For more information, please refer to the links below."
41
- article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2412.03555' target='_blank'>Model Paper</a> | <a href='https://huggingface.co/google/paligemma2-3b-ft-docci-448' target='_blank'>Model Page</a></p>"
42
-
43
-
44
- # Launch the interface
45
- interface = gr.Interface(
46
- fn=caption_image,
47
- inputs=[image, max_new_tokens, language, sampling],
48
- outputs=answer,
49
- examples=examples,
50
- cache_examples=True,
51
- cache_mode="lazy",
52
- title=title,
53
- description=description,
54
- article=article,
55
- theme="Monochrome",
56
- flagging_mode="never",
57
- )
58
- interface.launch(debug=False)