Commit
•
215f172
1
Parent(s):
92b7bbd
Fixing image
Browse files- app.py +4 -16
- media/reddit_scraper.drawio.png +0 -0
app.py
CHANGED
@@ -7,17 +7,10 @@ from rich.syntax import Syntax
|
|
7 |
|
8 |
proj_dir = Path(__name__).parent
|
9 |
|
10 |
-
subreddit = os.environ["SUBREDDIT"]
|
11 |
-
username = os.environ["USERNAME"]
|
12 |
dataset_name = f"{username}/dataset-creator-{subreddit}"
|
13 |
|
14 |
-
with open(proj_dir / "media/reddit_scraper.drawio.html", "r") as f:
|
15 |
-
html_string = f.read()
|
16 |
-
html_string.replace("SPACE_NAME", f"{username}/reddit-dataset-creator")
|
17 |
-
html_string.replace("SPACE_LINK", f"https://huggingface.co/spaces/{username}/reddit-dataset-creator")
|
18 |
-
html_string.replace("DATASET_NAME", f"{username}/dataset-creator-{subreddit}")
|
19 |
-
html_string.replace("DATASET_LINK", f"https://huggingface.co/datasets/{username}/dataset-creator-{subreddit}")
|
20 |
-
|
21 |
|
22 |
def log_file_to_html_string():
|
23 |
log_file = "mylog.log"
|
@@ -32,21 +25,16 @@ def log_file_to_html_string():
|
|
32 |
return html_content
|
33 |
|
34 |
|
35 |
-
# theme = gr.themes.Default().set(
|
36 |
-
# body_background_fill="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
37 |
-
# body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
38 |
-
# )
|
39 |
markdown = f"""
|
40 |
# Reddit Scraper
|
41 |
This is a reddit scraper which builds [{dataset_name}](https://huggingface.co/datasets/{dataset_name}).
|
42 |
|
43 |
See the diagram below:
|
44 |
-
|
45 |
-
{html_string}
|
46 |
"""
|
47 |
|
48 |
with gr.Blocks() as demo:
|
49 |
-
|
|
|
50 |
output = gr.HTML(log_file_to_html_string, every=1)
|
51 |
demo.load(None,
|
52 |
_js="""
|
|
|
7 |
|
8 |
proj_dir = Path(__name__).parent
|
9 |
|
10 |
+
subreddit = 'test' or os.environ["SUBREDDIT"]
|
11 |
+
username = 'test' or os.environ["USERNAME"]
|
12 |
dataset_name = f"{username}/dataset-creator-{subreddit}"
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def log_file_to_html_string():
|
16 |
log_file = "mylog.log"
|
|
|
25 |
return html_content
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
28 |
markdown = f"""
|
29 |
# Reddit Scraper
|
30 |
This is a reddit scraper which builds [{dataset_name}](https://huggingface.co/datasets/{dataset_name}).
|
31 |
|
32 |
See the diagram below:
|
|
|
|
|
33 |
"""
|
34 |
|
35 |
with gr.Blocks() as demo:
|
36 |
+
gr.Markdown(markdown)
|
37 |
+
gr.Image(proj_dir/'media'/'reddit_scraper.drawio.png')
|
38 |
output = gr.HTML(log_file_to_html_string, every=1)
|
39 |
demo.load(None,
|
40 |
_js="""
|
media/reddit_scraper.drawio.png
ADDED