[email protected] commited on
Commit
e3a23db
·
1 Parent(s): 3c258f1

dep update

Browse files
Files changed (3) hide show
  1. README.md +19 -4
  2. app.py +10 -4
  3. requirements.txt +2 -2
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🐨
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 5.6.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
@@ -14,9 +14,24 @@ license: mit
14
 
15
  ## Usage
16
 
 
17
  ```bash
18
- # Run the Gradio app
19
- gradio app.py # auto reload
20
- python app.py # static
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ```
 
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 5.9.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
14
 
15
  ## Usage
16
 
17
+ Run the Gradio app
18
  ```bash
19
+ # auto reload
20
+ gradio app.py
 
21
 
22
+ # manual reload
23
+ python app.py
24
+ ```
25
+
26
+ Install with virtual conda env:
27
+ ```bash
28
+ conda create -n seed-crawl-annotator python=3.10
29
+ conda activate seed-crawl-annotator
30
+ pip install -r requirements.txt
31
+ ```
32
+
33
+
34
+ Build Docker image
35
+ ```bash
36
+ docker build -t seed-crawl-annotator .
37
  ```
app.py CHANGED
@@ -35,7 +35,7 @@ def fetch_screenshot_and_text_from_url(url):
35
  screen_width = 1080
36
  height = 350
37
  text = ""
38
-
39
  if OFFLINE:
40
  screenshot = Image.new('RGB', (350, height))
41
  text = f"Some dummy text for {url} (offline mode enabled)"
@@ -122,9 +122,15 @@ with gr.Blocks(fill_height=True) as demo:
122
  load_btn = gr.Button("Annotate URL", variant="primary", interactive=True)
123
 
124
  with gr.Row():
125
- extracted_text = gr.Textbox(label="Extracted text", max_lines=15, lines=15, visible=False, placeholder="Click on `Load URL` to fetch Web page's text content.")
 
 
 
 
 
 
126
 
127
- screenshot_scrollable = gr.HTML(visible=False)
128
 
129
  with gr.Column(visible=False) as output_col:
130
  with gr.Row():
@@ -186,7 +192,7 @@ with gr.Blocks(fill_height=True) as demo:
186
  return {
187
  url_field: "",
188
  output_col: gr.update(visible=False),
189
- extracted_text: gr.update(value=None, visible=False),
190
  screenshot_scrollable: gr.update(value="", visible=False),
191
  }
192
 
 
35
  screen_width = 1080
36
  height = 350
37
  text = ""
38
+
39
  if OFFLINE:
40
  screenshot = Image.new('RGB', (350, height))
41
  text = f"Some dummy text for {url} (offline mode enabled)"
 
122
  load_btn = gr.Button("Annotate URL", variant="primary", interactive=True)
123
 
124
  with gr.Row():
125
+ extracted_text = gr.Textbox(
126
+ label="Extracted text",
127
+ max_lines=15,
128
+ lines=15,
129
+ visible=True,
130
+ placeholder="Click on `Load URL` to fetch Web page's text content."
131
+ )
132
 
133
+ screenshot_scrollable = gr.HTML("", visible=False)
134
 
135
  with gr.Column(visible=False) as output_col:
136
  with gr.Row():
 
192
  return {
193
  url_field: "",
194
  output_col: gr.update(visible=False),
195
+ extracted_text: gr.update(value=None, visible=True),
196
  screenshot_scrollable: gr.update(value="", visible=False),
197
  }
198
 
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  selenium >=4.0.0, < 5.0.0
2
- gradio>=3.40.1
3
  Pillow>=8.3.1,<9.0
4
- trafilatura
5
  gradio[oauth]
 
1
  selenium >=4.0.0, < 5.0.0
2
+ gradio==5.9.1
3
  Pillow>=8.3.1,<9.0
4
+ trafilatura==2.0.0
5
  gradio[oauth]